darcs

Patch 1633 Resolve issue2545: prepend "--" to non-option arguments in ssh invocation

Title Resolve issue2545: prepend "--" to non-option arguments in ssh invocation
Superseder Nosy List gpiero
Related Issues
Status accepted Assigned To
Milestone

Created on 2018-01-06.07:17:30 by gpiero, last changed 2023-01-06.14:42:03 by bfrk.

Files
File name Status Uploaded Type Edit Remove
adapt-transfer_mode-test-to-new-debug-message-arguments-escaping.dpatch gh, 2018-02-07.21:29:57 application/octet-stream
improve-debug-messages-about-invocation-of-external-ssh-commands.dpatch gpiero, 2018-01-08.19:25:51 application/octet-stream
issue2545_command-execution-via-ssh-uri.sh-portability-fix.dpatch gpiero, 2018-01-08.19:29:20 application/octet-stream
tests_sshlib_-add-a-helper-function-for-initializing-a-remote-repo.dpatch gpiero, 2018-01-06.07:17:29 application/octet-stream
See mailing list archives for discussion on individual patches.
Messages
msg19817 (view) Author: gpiero Date: 2018-01-06.07:17:29
patch 315bc9fb58ce4245be4bb443d29ae3d1fccd2257 is named '* Resolve
issue2545:
...' in order to automatically close the bug (and because it effectively
solve
the issue:).
Anyway I plan to send a more comprehensive patch that will not allow
host names
starting with a '-'. That is the same approach used by git, svn and,
IIRC, hg.
The rationale is that the use of '--' for signaling end of options is
implementation-dependent (well, so is the use of '-' as the first char of an
option). Given that AFAIK a host name starting with '-' is invalid as per
RFC-1123, I don't see any problems in implementing it also in darcs.

At last, git also disabled repositories starting with a '-'. While not
the best
choice for naming a directory (at least on POSIX), I think (but not
thoroughly
checked) that such a dir name would not create problems in darcs and I'm not
leaning to support this restriction.
Attachments
msg19819 (view) Author: gpiero Date: 2018-01-08.19:25:51
patch 4ecf394c343d80f68c25d53bc1acf2eed1bd0a27
Author: Gian Piero Carrubba <gpiero@rm-rf.it>
Date:   Mon Jan  8 13:57:46 CET 2018
  * Fix test broken by patch 8706d6e70c1aa572f383882c371a9bafbec3dc38
  (Improve debug messages about invocation of external SSH commands)
Attachments
msg19820 (view) Author: gpiero Date: 2018-01-08.19:29:20
patch 1b543dc9c0e2ca4ced934e58eed081c3f69c5627
Author: Gian Piero Carrubba <gpiero@rm-rf.it>
Date:   Mon Jan  8 20:12:29 CET 2018
  * t/n/issue2545_command-execution-via-ssh-uri.sh: portability fix
Attachments
msg19826 (view) Author: gh Date: 2018-01-21.20:55:20
Hi Gian Piero,

your patches look sensible in principle, so I'm screening them. Thanks
for addressing issue2545 ; this is definitely something we want in the
next stable release.

Just so you know, `darcs init '$repodir'` is accepted, it is equivalent
to `darcs init --repo '$repodir'`.

Guillaume
msg19833 (view) Author: gh Date: 2018-02-07.21:29:57
A followup patch:

1 patch for repository http://darcs.net:

patch 724791e562535703e8b9fd552fa875f07e79baf8
Author: Guillaume Hoffmann <guillaumh@gmail.com>
Date:   Wed Feb  7 18:27:44 -03 2018
  * adapt transfer-mode test to new debug message arguments escaping
Attachments
msg19973 (view) Author: gh Date: 2018-03-15.19:10:04
Looks good, accepted.
msg23055 (view) Author: gpiero Date: 2022-12-18.11:40:26
* [Sat, Jan 06, 2018 at 07:17:30AM +0000] Gian Piero Carrubba:
[...]
>Anyway I plan to send a more comprehensive patch that will not allow
>host names starting with a '-'. That is the same approach used by git, 
>svn and, IIRC, hg.
>The rationale is that the use of '--' for signaling end of options is
>implementation-dependent (well, so is the use of '-' as the first char 
>of an option). Given that AFAIK a host name starting with '-' is 
>invalid as per RFC-1123, I don't see any problems in implementing it 
>also in darcs.

I've fiddled a bit with this, and now I don't think it's a good idea.  
The fact is that we don't actually care about the first character of the 
hostname, but about the first character of the destination string, that 
can be in one of the following formats:

- hostname[:port]
- user@hostname[:port]
- ssh://[user@]hostname[:port]

The problematic case is the second one. Usernames starting with a '-' 
are theoretically possible on *nix, even if they probably do not work 
because of restrictions imposed by different programs. The major 
impediment is on Windows, as - if I've correctly read [0] - usernames 
starting with a '-' are allowed (they call it 'dash', but I'm pretty 
sure they mean the ASCII 'hyphen').

[0] 
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/bb726984(v=technet.10)?redirectedfrom=MSDN
msg23074 (view) Author: bfrk Date: 2023-01-06.14:42:00
Am 12/18/22 um 12:40 schrieb Gian Piero Carrubba:
> The major
> impediment is on Windows, as - if I've correctly read [0] - usernames
> starting with a '-' are allowed (they call it 'dash', but I'm pretty
> sure they mean the ASCII 'hyphen').
Nowadays my take on issues like that is: we can and should place our own 
restrictions where this seems reasonable. So what if some Systems allow 
to name a user account "--help"? It is bad enough that they do, that 
doesn't mean we have to support such abuses.
History
Date User Action Args
2018-01-06 07:17:30gpierocreate
2018-01-08 19:25:51gpierosetfiles: + improve-debug-messages-about-invocation-of-external-ssh-commands.dpatch
messages: + msg19819
2018-01-08 19:29:20gpierosetfiles: + issue2545_command-execution-via-ssh-uri.sh-portability-fix.dpatch
messages: + msg19820
2018-01-21 20:55:20ghsetstatus: needs-screening -> needs-review
messages: + msg19826
2018-02-07 21:29:57ghsetfiles: + adapt-transfer_mode-test-to-new-debug-message-arguments-escaping.dpatch
messages: + msg19833
2018-03-15 19:10:04ghsetstatus: needs-review -> accepted
messages: + msg19973
2022-12-18 11:40:26gpierosetmessages: + msg23055
2023-01-06 14:42:03bfrksetmessages: + msg23074