Jason Andryuk writes ("Re: [XEN RFC for-4.14] Re: use of "stat -""):
> On Thu, Jun 25, 2020 at 10:08 AM Jan Beulich <jbeul...@suse.com> wrote:
> > I'm about to test this then, but to be honest I have no idea what
> > to do with the comment. I don't think I could properly justify its
> > deletion in the description (beyond saying it's not really true),
> > nor would I be certain whether to e.g. leave the test -ef part
> > there.
> 
> Yes, this is what made me pause yesterday.  Also, I'm not sure how
> test -ef would be used to check the file & FD.

$ >t
$ exec 3>t
$ rm u
rm: cannot remove 'u': No such file or directory
$ ln t u
$ test t -ef u && echo y
y
$ test /dev/stdin <&3 -ef u && echo y
y
$ mv t v
$ test /dev/stdin <&3 -ef u && echo y
y
$ rm v
$ test /dev/stdin <&3 -ef u && echo y
y
$

This appears to work.  In principle we could switch to this, but (i)
we would want to check that all (recent?) versions of bash do the
sensible thing (ii) we are in a release freeze.

> > Also is there any reason to go through two symlinks then, rather
> > than using /proc/self/fd/$_lockfd directly?
> 
> I think /proc/self/fd/$_lockfd should just be used to avoid playing
> unnecessary FD games.

Xen is frozen at the moment.  Can we please make the minimal change,
rather than the change which cleans the code up the most ?

That does imply some technical debt, but has the lowest risk for the
release.

If you like, combine it with a second patch that changes things to use
test -ef, for post-4.14 ?

Thanks,
Ian.

Reply via email to