Re: [PATCH 2/3] t5615: avoid re-using descriptor 4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 21, 2017 at 02:19:16AM +0200, Simon Ruderich wrote:

> On Fri, Oct 20, 2017 at 06:46:08PM -0400, Jeff King wrote:
> >> I agree. Maybe just stick with the original patch?
> >
> > OK. Why don't we live with that for now, then. The only advantage of the
> > "999" trickery is that it's less likely to come up again. If it doesn't,
> > then we're happy. If it does, then we can always switch then.
> 
> I think switching the 4 to 9 (which you already brought up in
> this thread) is a good idea. It makes accidental conflicts less
> likely (it's rare to use so many file descriptors) and is easy to
> implement.

I'm not sure it does make accidental conflicts less likely. Grepping for
'9>' shows a problematic one in t0008, and one in t9300. That's two
versus the one for "4". :)

We often use descriptors 8 or 9 as "high and not taken for any specific
use" in our tests, and do things like:

  mkfifo foo
  exec 9>foo
  ...
  exec 9>&-

This is unlike a redirection in a sub-command (like "foo 9>bar") because
it effects the whole test suite's state. So it would break the test
under "-x" (because we'd get random cruft sent to the fifo), as well as
breaking the "-x" output itself (because we close the descriptor).

I actually think "7" is the safest descriptor right now. It's not used
for anything, and it's not high enough for tests to think "this probably
isn't used for anything".

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux