On Fri, Dec 23, 2011 at 02:20:24PM +0000, Luo Zhenhua-B19537 wrote:
> If the specified user/group is invalid, I think this should be an
> usage error instead of script error.
Hold on - how are you getting an invalid uid/gid? Those values are
set by the configure script to the uid/gid of the builder process,
and so should -never- be invalid.
Are you building on one machine, rsyncing to another machine with
different user/groups and then running make install? If so, you are
using make install incorrectly. make install is designed to install
the binaries on the host that they were built, not some other random
machine. If you are going to install binaries on a different machine
to where they were built, you are supposed to build a tarball, a
.deb or .rpm package and install that. Those targets are macine
independent and won't have install problems.
> 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.
I had to manually change the include/builddefs file to have an
invalid PKG_USER/PKG_GROUP variables to get chown to fail because
all my build/test machines have consistent uid/gid entries, so even
build/rsync/install works without fail....
And if you look at what your change actually does, the script still
executes and installs -some- stuff, it just doesn't run the chown
because _chown() is now not passed the correct number of parameters.
IOWs, the script now fails with a partial install with no indication
of what was installed or not.
If you are going to check whether uid/gid exist, you need to exit
immediately if they don't exist, not allow the script to continue.