On 8/26/06, Martin Bähr <[EMAIL PROTECTED]> wrote:
> hi,
>
> stumbled on another wierd bug that i can't make any sense of:
>
> > cat foo  | while read i j; echo $i,$j; mv -i $i {$j}.ttf; end | less
> mv: cannot stat `163641.ttf': No such file or directory
> mv: cannot stat `1336501.ttf': No such file or directory
> mv: cannot stat `961162.ttf': No such file or directory
> mv: overwrite `Arial.ttf'? fish: Could not send process 16515 from group 
> 16377 to group 16506
> setpgid: Operation not permitted
> fish: Could not send job 1 (#cat foo | while read i j; echo $i,$j; mv -i $i
> {$j}.ttf; end | less#) to foreground
> tcsetpgrp: Operation not permitted
> 163641.ttf,Andover
> 1336501.ttf,Arial
> 961162.ttf,Arial
> 912439.ttf,Arial
> fish: Could not send process 16516 from group 16377 to group 16506
> setpgid: Operation not permitted
> fish: Could not send job 1 (#cat foo | while read i j; echo $i,$j; mv -i $i
> {$j}.ttf; end | less#) to foreground
> tcsetpgrp: Operation not permitted
> fish: Could not send job 1 (#cat foo | while read i j; echo $i,$j; mv -i $i
> {$j}.ttf; end | less#) to foreground
> tcsetpgrp: Operation not permitted
> Missing filename ("less --help" for help)
>
> at this point the whole thing hangs uninteruptably
>
> the contents of foo are lines like:
> 293856.ttf      Celticmd Decorative w Drop Caps
> 961164.ttf      Font in a Red Suit (The Christmas Font)
> 163644.ttf      Font
> 163654.ttf      Yikes!
>
> (don't ask me about the fonts these are files recovered from a disk crash :-)

I can reproduce this behaviour when in interactive mode. Seems to be a
problem with blocks in pipelines that only surfaces in interactive
mode. Will look into it.

Side note: The original command shouldn't work even without the fish
bug, since the way fish works is that if an entire block (such as the
above while loop) is inside a pipeline, then all the commands of that
block get their input/output redirected. So what will happen is that
'mv -i' will prompt the user using stdin, but stdin is the file 'foo'.
So on the first collision, 'mv' will start reading the contents of
'foo' looking for a yes/no answer to the overwrite query. Most likely
this will consume all of the file foo, so the result will be that the
script quits on the first collision.

Try executing the same command as a script, and you will see this
behaviour, as you bug is interactive-mode specific.

These versions of the script work. The former uses stderr as the new
stdin for mv, the second one avoids redirecting stdin altogether. The
first version is still hit by the original fish bug, though, so it
only works as a script right now.

cat foo | while read i j; echo $i,$j; mv -i $i {$j}.ttf <&2; end | less
for k in (cat foo); echo $k|read i j; echo $i,$j; mv -i $i $j.ttf; end | less

Thank you for the bug report. Keep them coming!

>
> greetings, martin.
> --
> cooperative communication with sTeam      -     caudium, pike, roxen and unix
> offering: programming, training and administration   -  anywhere in the world
> --
> pike programmer   travelling and working in europe             open-steam.org
> unix system-      bahai.or.at                        iaeste.(tuwien.ac|or).at
> administrator     (caudium|gotpike).org                          is.schon.org
> Martin Bähr       http://www.iaeste.or.at/~mbaehr/
>


-- 
Axel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to