NetBSD-Bugs archive

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

Re: bin/55815: tar opens device files



The following reply was made to PR bin/55815; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/55815: tar opens device files
Date: Wed, 25 Nov 2020 22:51:59 +0700

     Date:        Wed, 25 Nov 2020 09:20:01 +0000 (UTC)
     From:        Martin Husemann <martin%duskware.de@localhost>
     Message-ID:  <20201125092001.974C81A921F%mollari.NetBSD.org@localhost>
 
   |  I agree that device open having an effect on the state of the device is
   |  a bad thing in general,
 
 I'm not sue I really agree, though "deferred to the first I/O" would be
 semantically equivalent I think (except that with tapes, just open/close
 has always been a method to accomplish rewind), so that would be possible.
 But not "doing things" at all would be wrong (would break a long time
 interface expectation, whatever anyone believe it ought to be).
 
   |  but it has been the case in Unix since the beginning,
   |  or am I misremembering something?
 
 You're not, that is the way it has always been - or at least as far back
 as I can remember (I never saw any of 1st-4th edition systems).
 
 I am not sure I understand the point here though, why is tar opening
 files at all if it doesn't plan on reading from them?   Is this some
 kind of optimisation attempt, where since most files will be regular
 filesystem files, and will need to be opened, open() then fstat() has
 one less pathname lookup (namei) than stat() followed when needed by open()
 (the normal case)?    If so, we should just stop doing that, as it is broken,
 and revert to the stat()+open() model (where the open only happens if we
 want the data contained in the file, rather than just its name and attributes).
 We need that for symnlinks too (ie: the stat() would actually be lstat()),
 surely.
 
 I don't know what's available for fetching extattrs, but if that requires
 an open, we should fix that, and make them available without opening.
 But surely there is already a way, I can't believe that ls attempts to
 open files, yet it shows (when asked) extattrs, right?
 
 kre
 
 


Home | Main Index | Thread Index | Old Index