If the specified user/group is invalid, I think this should be an usage error
instead of script error.
Current the problem I met is that, even if I specified a valid user/group of my
host, "chown user:group file" failed, after switching to corresponding uid/gid,
the script can be executed successfully during the install process.
Best Regards,
Zhenhua
> -----Original Message-----
> From: Dave Chinner [mailto:david@xxxxxxxxxxxxx]
> Sent: Friday, December 23, 2011 6:02 PM
> To: Luo Zhenhua-B19537
> Cc: xfs@xxxxxxxxxxx
> Subject: Re: [PATCH] xfsprogs: use uid/gid instead of actual name to fix
> install
> issue
>
> On Fri, Dec 23, 2011 at 02:52:53PM +0800, b19537@xxxxxxxxxxxxx wrote:
> > From: Zhenhua Luo <b19537@xxxxxxxxxxxxx>
> >
> > > when running install-sh during the install process, following
> > error might appear:
> > > ../../install-sh -o bj -g bj -m 644 -T so_dot_version libhandle.lai
> /lib; ../../install-sh -o bj -g bj -T so_dot_current libhandle.lai /lib
> > > chown: invalid user: `bj:bj'
> > > chown: invalid user: `bj:bj'
> > > Installing libdisk-install
> > > make[1]: Nothing to be done for `install'.
> > > Installing copy-install
> > > ../install-sh -o bj -g bj -m 755 -d /usr/sbin
> > > chown: invalid user: `bj:bj'
> > > make[1]: *** [install] Error 1
> > > make: *** [copy-install] Error 2
> >
> > Signed-off-by: Zhenhua Luo <b19537@xxxxxxxxxxxxx>
> > ---
> > include/install-sh | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/install-sh b/include/install-sh index
> > 18c051f..9d8ff06 100755
> > --- a/include/install-sh
> > +++ b/include/install-sh
> > @@ -105,10 +105,10 @@ do
> > c)
> > ;;
> > g)
> > - GROUP=$OPTARG
> > + GROUP=`id -g $OPTARG`
> > ;;
> > o)
> > - OWNER=$OPTARG
> > + OWNER=`id -u $OPTARG`
> > ;;
> > m)
> > DIRMODE=`expr $OPTARG`
>
> How does this fix the the problem that the user/group "bj" does not exist?
>
> $ id -g bj
> id: bj: No such user
> $ id -g bj 2> /dev/null
> $
>
> All this patch does is result in a OWNER/GROUP variable that is empty when an
> invalid user/group is specified. Hence it will make the install complete with
> a
> different user to the one specified in the install command line. It should
> error
> out (like it does now) if a user/group does not exist, not install as some
> other
> (unknown) user.
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@xxxxxxxxxxxxx
|