On Wed, Feb 26, 2020 at 3:49 PM Ian Jackson <ian.jack...@citrix.com> wrote:

> Jason Andryuk writes ("[PATCH 1/2] tools/helpers: Introduce
> cmp-fd-file-inode utility"):
> > This is a C implementation of the perl code inside of locking.sh to
> > check that the locked file descriptor and lock file share the same inode
> > and therefore match.  One change from the perl version is replacing
> > printing "y" on success with exit values of 0 (shell True) and 1 (shell
> > False).
>
> Maybe it would be better to use stat(1) ?  On Linux
>    stat -L -c%D.%i /dev/stdin blah.lock
> or some such, and then compare the two numbers.
>
> I'm reluctant to host a general-purpose shell utility in xen.git, no
> matter how useful...
>

Do you have any other suggestions?

I agree it's not great to have loads of little helper programs lying
around.  But it's a lot better than pulling in a full perl installation for
a single line.

I sort of feel like part of the issue is that this is written in shell at
all.  The necessity to fall back to perl seems to me to indicate that bash
is the wrong language for what needs to happen here.  If locking.sh were
locking.c instead, this entire series probably wouldn't be necessary.

If no better options are forthcoming, I think we should accept something
like this until something better comes along.

 -George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to