From: dbaarda AT baea DOT com DOT au (BAARDA, Don) Subject: B20: Strange intermittent globing bug? File locking?. 24 Nov 1998 07:56:41 -0800 Message-ID: <098D75523766D111AAA300805FF59873081585.cygnus.gnu-win32@MDNTEX1> Mime-Version: 1.0 Content-Type: text/plain To: "'gnu-win32 AT cygnus DOT com'" G'day all, I've found some weird behaviour that I thought was some vestigial failed hack attempts to get less working with bash. Back in the B19 days I created my own "less" command that fired up notepad. When I upgraded to B20 it broke, but in a weird way. It would lock up before starting notepad, and only ^C would return me to the prompt. Then I changed the name to "less.old" and it worked (mv less less.old). Then I moved it back to less and it locked up. Then I moved it to "l" and it still locked up (kill the hack attempts for "less" theory). These problems appeared to be definitely repeatable, and I thought I could pin it down to a globing problem for filenames without a period in them. The script looked like; #!/bin/sh TEMPFILE=$TEMP\\$$.tmp cat "$@" > $TEMPFILE (notepad $TEMPFILE ; rm $TEMPFILE) & Then I started playing with the code, commenting out lines and adding echo/cat things. The problems persisted, with no output before the lockup, even when the script was reduced to the following; #!/bin/sh TEMPFILE=$TEMP\\$$.tmp echo "$@" cat "$@" #cat "$@" > $TEMPFILE #(notepad $TEMPFILE ; rm $TEMPFILE) & At some point, the problem mysteriously stopped, and I my once repeatable problem stopped repeating. I have no idea why it stopped. The four lines of script are unchanged AFAIK, and I can call it anything and it works. The only theories I have are that maybe there was a hidden control character buried in the script that my editing removed, or "something else" happened. Maybe the fact that I was running it with itself as a parameter was intermittently (or rather consistently) hitting some file locking problem? While the problem was there, I repeatedly demonstrated the problem by "mv less less.old; less.old less.old; it works" and "mv less.old less; less less; it locks up" over two days and multiple attempts. I also repeatedly checked "type less" to make sure I was running what I thought I was. I also added and removed the "debug" code a few times over the two days and it still seemed repeatable. I only experimented with names other than "less" and "less.old" towards the end, which revealed that using the name "less" was not necessarily the culprit, but other names also had the problem. Just as I was trying to characterise what names did and didn't work, the problem went away. I'm glad it now works, but I'm really puzzled and slightly worried by whatever it was. Maybe it's some text vs binary mode feature? Don - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".