[coreutils-6.9] multiple utilities not handling escape char(\) properly when used with -, instead interpreting as option(could be a bash bug?)
ClarkConnect Community Edition release 4.0 (kernel 2.6.9-42.cc) I compiled the latest coreutils from source. Then I ran these series of commands: coreutils-6.9]# mkdir testdir coreutils-6.9]# cd testdir/ testdir]# ../src/touch +foo0 testdir]# ../src/touch \+foo1 testdir]# ../src/touch -bar0 ../src/touch: invalid option -- e Try `../src/touch --help' for more information. ^^ That error is correct as the - char is used for options. testdir]# ../src/touch \-bar1 ../src/touch: invalid option -- e Try `../src/touch --help' for more information. ^^ This is wrong, this should work!! testdir]# ../src/touch \\-bar2 ^^ Trying a double backslash to see what happens testdir]# ls +foo0 +foo1 \-bar2 ^^ It is what is expected. testdir]# ../src/touch '-bar3' ../src/touch: invalid option -- e Try `../src/touch --help' for more information. ^^ Trying single quotes testdir]# ../src/touch -bar4 ../src/touch: invalid option -- e Try `../src/touch --help' for more information. ^^ Trying double quotes testdir]# ../src/mv +foo0 -bar5 ../src/mv: invalid option -- e Try `../src/mv --help' for more information. ^^ That error is correct as the - char is used for options. testdir]# ../src/mv +foo0 \-bar6 ../src/mv: invalid option -- e Try `../src/mv --help' for more information. ^^ This is wrong, this should work!! testdir]# ../src/touch ./-bar7 testdir]# ../src/touch ./\-bar8 testdir]# ls +foo0 +foo1 \-bar2 -bar7 -bar8 testdir]# As you can see from the above commands, \-barX is being interpreted as an option to touch/mv/etc instead of being part of the filename. Hooroo, Wilber ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: [coreutils-6.9] multiple utilities not handling escape char(\) properly when used with -, instead interpreting as option(could be a bash bug?)
Wilber Washbucket [EMAIL PROTECTED] writes: ClarkConnect Community Edition release 4.0 (kernel 2.6.9-42.cc) I compiled the latest coreutils from source. Then I ran these series of commands: coreutils-6.9]# mkdir testdir coreutils-6.9]# cd testdir/ testdir]# ../src/touch +foo0 testdir]# ../src/touch \+foo1 testdir]# ../src/touch -bar0 ../src/touch: invalid option -- e Try `../src/touch --help' for more information. ^^ That error is correct as the - char is used for options. That is a variant of question 11 in the coreutils FAQ. http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#How-do-I-remove-files-that-start-with-a-dash_003f testdir]# ../src/touch \-bar1 ../src/touch: invalid option -- e Try `../src/touch --help' for more information. ^^ This is wrong, this should work!! The backslash has been removed by the shell before the touch command has seen it. Try prefixing all your tries with echo to seen the actual command line that is executed. Btw., when I try to execute that command, I get a different error: ../src/touch: invalid option -- b Try `../src/touch --help' for more information. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: [coreutils-6.9] multiple utilities not handling escape char(\) properly when used with -, instead interpreting as option(could be a bash bug?)
On Wed, 18 Jul 2007, Wilber Washbucket wrote: I compiled the latest coreutils from source. Then I ran these series of commands: coreutils-6.9]# mkdir testdir coreutils-6.9]# cd testdir/ testdir]# ../src/touch +foo0 testdir]# ../src/touch \+foo1 testdir]# ../src/touch -bar0 ../src/touch: invalid option -- e Really? There is no option e specified. Try `../src/touch --help' for more information. ^^ That error is correct as the - char is used for options. testdir]# ../src/touch \-bar1 ../src/touch: invalid option -- e Try `../src/touch --help' for more information. ^^ This is wrong, this should work!! This isn't due to coreutils, nor is really a bash bug; rather it's an artifact of how shell escaping works. Please try set +x in bash to view the commandlines after escape-processing, to see how touch is actually seeing your commands. testdir]# ../src/mv +foo0 -bar5 ../src/mv: invalid option -- e Try `../src/mv --help' for more information. ^^ That error is correct as the - char is used for options. That's a slightly different issue. coreutils are permissive in their options parsing. By setting the environment variable POSIXLY_CORRECT, this command will complete without error. Cheers, Phil ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils