Project

General

Profile

Actions

Bug #4396

closed

windows commands starting with "@" should run at all even though command string is quoted by `"'.

Added by kosaki (Motohiro KOSAKI) about 13 years ago. Updated almost 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2011-02-09 trunk 30831) [i386-mswin32_100]
Backport:
[ruby-core:35227]

Description

=begin
This issue

C test program.

main()
{
system(""@echo foo"");
}

=> foo

Ruby test program.

ruby -e 'p system(""@echo foo"")'

=> nil
=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #4393: windows commands starting with "@" should run at allClosed02/13/2011Actions
Actions #1

Updated by kosaki (Motohiro KOSAKI) about 13 years ago

=begin
If you are writing C and you need to run "@echo" command, you should escape the string by `^' (caret).

ie,

main()
{
system("^@echo foo");
}


It's MSVCRT spec. I'm not sure ruby's system() method should follow it or not.
Maybe we need a discussion.
=end

Actions #2

Updated by jonforums (Jon Forums) about 13 years ago

=begin
fwiw, behavior on win7 32-bit with lua v5.1.4 and python v2.7.1...

C:>lua -e "os.execute('@echo foo')"
foo

C:>lua -e "os.execute('^@echo foo')"
'@echo' is not recognized as an internal or external command,
operable program or batch file.

C:>python -c "import os;os.system('@echo foo')"
foo

C:>python -c "import os;os.system('^@echo foo')"
'@echo' is not recognized as an internal or external command,
operable program or batch file.
=end

Actions #3

Updated by jonforums (Jon Forums) about 13 years ago

=begin
and...

C:>lua -e "os.execute("^@echo foo")"
foo

C:>python -c "import os;os.system("^@echo foo")"
foo

=end

Actions #4

Updated by kosaki (Motohiro KOSAKI) about 13 years ago

=begin
Hi Jon,

Thanks for good demonstration. It encourage to me very much.
But #3 is a bit misleading. ^ was removed when command line parsing (ie python interpreter invoking) phase. therefore system() haven't seen ^.

Example, Please see following one liner.

c:\ruby\trunk\build>python -c "print "^@echo foo""
@echo foo

=end

Updated by kosaki (Motohiro KOSAKI) about 13 years ago

  • Status changed from Open to Rejected

=begin
I tried to change this behavir by r30987. but it made a regression.

example, r30987 broke test_process.rb#test_popen_shell(). because
IO.popen(%[#{bat.dump} "foo 'bar'"]) pass a follwoing string to cmd.exe.

"path with space/bat test.bat" "foo 'bar'"

But cmd.exe can't parse it. IOW, current ruby's system() has slightly different parser against cmd.exe and some tests depend on it.

So, sadly, we can't break backward compatibility. Let's reject this ticket.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0