oils-for-unix / oils

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.85k stars 159 forks source link

feat: noclobber shell option #2008

Closed momiji closed 4 months ago

momiji commented 4 months ago

BTW, I have absolutely no idea where this vigoroustelevision comes from...

momiji commented 4 months ago

do you think this can be merged soon, either on master of the soil-staging? BTW, what does "soil-staging" mean? is it just a copy of master or something else?

andychu commented 4 months ago

Hi @momiji , wondering if you saw my comments?

What do you think of merging the minimal thing, and then tackling the error messages separately? I agree something needs to be done there, but I think we haven't figured it out yet

andychu commented 4 months ago

I am looking at this again, I ran the spec tests and the output looks like

osh stderr:
rm: cannot remove '/home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh.3956901/27-osh/no-clobber': No such file or directory
[ stdin ]:5: I/O redirect error: can't overwrite existing file '/home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh.3956901/27-osh/no-clobber': File exists
andychu commented 4 months ago

Hm, this is the error without the specal 0 case

There is some redundancy, but I have seen this elsewhere

Also I think it is better to quote the code. Somehow the code quotation was omitted in the original

osh stderr:
rm: cannot remove '/home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh.3959868/27-osh/no-clobber': No such file or directory
  echo foo > $TMP/no-clobber
           ^
[ stdin ]:5: Can't open '/home/andy/git/oilshell/oil/_tmp/spec-tmp/sh-options.test.sh.3959868/27-osh/no-clobber': File exists
[ stdin ]:5: I/O error applying redirect: File exists
andychu commented 4 months ago

OK I merged this, with minor changes

We can track the error message issue separately - it isn't specific to noclobber - https://github.com/oils-for-unix/oils/issues/2035