Date: Wed, 17 Jul 2002 23:49:02 GMT From: Abc Xyz <abc@anchorageinternet.org> To: "freebsd-questions" <questions@freebsd.org> Subject: Re: /dev/null and 2>&- Message-ID: <200207172349.g6HNn2wu097902@anchorageinternet.org>
next in thread | raw e-mail | index | archive | help
> > > > i just installed 4.6-RELEASE, and notice that > > > > the '2>&-' sh (FBSD) construct seems to be broken. > > > > i am going thru all my scripts having to change > > > > it to /dev/null ... > > > If the construct is generally used for hiding errormessages, one > > > should probably replace it with '2>/dev/null' anyway, since 2>&- > > > only closes filedescriptor 2 at startup of program and the first file > > > the program opens will be assigned the very same and all output > > > to stderr will come up in that file. > > > Example, > > > sh> tee < /dev/null 2>&- empty /nonexistent/missingfile > > > sh> cat empty > > > tee: /nonexistent/missingfile: No such file or directory > > > sh> > > this example above is incorrect with regards to 4.6-RELEASE. > Sorry, I forgot I had replaced my /bin/sh in 4.6-RELEASE with /bin/sh > from 5.0-CURRENT due to problems when I was building and installing > CURRENT over RELEASE. /bin/sh core-dumped under installation so I > replaced the RELEASE sh with CURRENT:s and then the rest of installation > worked. yes - ok - well - it's got some problems then. i don't know of the other problems, but i know of this one - the one i posted here. so i guess i will do a send-pr. > So, I have also have had trouble with /bin/sh from 4.6-RELEASE but in > CURRENT it works again. I dont know how /bin/sh works in 4.6-STABLE > Are where someone out there who wants to test it? And have > better answers? test what? test sh? well - i will test it, i really need the robustness of a "release" version, and i do need a fully functional shell - i rely on shell scripts heavily. i think POSIX has a "sh" test suite for shells. i dunno if this is worth mentioning. > > with 4.6-RELEASE, output is as follows: > > > > Example, > > sh> tee < /dev/null 2>&- empty /nonexistent/missingfile > > tee: /nonexistent/missingfile: No such file or directory > > sh> cat empty > > sh> > > > > > sh> tee < /dev/null 2>/dev/null empty /nonexistent/missingfile > > > sh> cat empty > > > sh> > > > > > > i figure it's not realistic to assume a bug this > > > > obvious would make it to release stage, so my > > > > question is - is something else going on? > > > > or is this just due to changes in 'sh'? > > > > is it a bug? or is it a permenent change? > I dont know the history of sh, but I also think it as a bug, > and from my experience with CURRENT it look as it changed > back to normal. But maybe there is an intended change, should > look in STABLE. well, i know the "bug" i report here is different all the way back to 1.X releases of FBSD. i have been using it since 1995, (but that doesn't mean i am an expert yet! heh) and this "bug" i mention is different only with 4.6-RELEASE. > I have a vague memory of seeing mail about special treatment of > filedescriptors 0,1 and 2 when calling fork() or was it setuid(), > dont remember ... might be connected or? i don't know - i never had time to become a "hard core" developer. i use FBSD for work and play and don't program at OS levels. when i look at FBSD code i can only gasp at the thought of someone comprehending it all :) i am just a "script kiddie" :) thank you. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207172349.g6HNn2wu097902>