Re: issue with pkg_add

2010-10-20 Thread Jason Helfman
On Wed, 20 Oct 2010 09:13:32 +0100
Florent Thoumie f...@xbsd.org wrote:

 On Wed, Oct 20, 2010 at 1:46 AM, Jason Helfman
 jhelf...@experts-exchange.com wrote:
 
  Hi,
 
  I believe I may have come across a potential bug in pkg_add, but
  wanted to write my findings out to see if anyone has seen this
  issue, or knows of something I may be doing wrong.
 
  I wrote a port that uses USERS/GROUPS functionality of ports.
 
  USERS=          user
  GROUPS=         user_work
  BINOWN=         user
  BINGRP=         user_work
  BINMODE=        4110
 
  These are the exec lines in my +CONTENTS file (assume one line for
  each exec, they were wrapped):
  @exec if ! /usr/sbin/pw groupshow user_work /dev/null 21;
  then /usr/sbin/pw groupadd user_work -g 999; fi
  @exec if ! /usr/sbin/pw usershow user /dev/null 21;
  then /usr/sbin/pw useradd user -u 999 -g 999  -c user
  -d /home/user -s /usr/sbin/nologin; fi
 
  I found that on my desktop with a ports tree installed that this
  port and package installed with no issue, however I found that if I
  tried to install the package in a jail with no ports tree and
  nothing installed that it failed with this error:
 
  pw: group `999' does not exist
  pkg_add: command 'if ! /usr/sbin/pw usershow user /dev/null 21;
  then /usr/sbin/pw useradd user -u 999 -g 999  -c user
  -d /home/user -s /usr/sbin/nologin; fi' failed
 
 You may want to run pkg_add -v and see if the group is created
 properly by the preceding @exec line and if not, why.

I found that the group that was being added already existed under a
different gid.  The user was being added with a gid that didn't exist,
however the group name did.

After blowing away the jail and removing the group, pkg_add installed
the package with no issue.

 
  I removed all remnants of the installation (these packages were all
  successful builds in Tinderbox), including installed users/groups. I
  copied my UIDs and GIDs files to an empty /usr/ports directory. So
  the only files under /usr/ports were UIDs and GIDs.
 
  With these files in place, I reran the pkg_add command on the port
  package I created and it installed the user and group with no issue,
  with correct permissions and modes on the files.
 
  With this testing, it appears that pkg_add is looking
  at /usr/ports/UIDs and /usr/ports/GIDs for information on
  installing a port package, even-though all of the information
  required for an installation appears to be in my port package.
 

I re-tested this process after blowing away the jail and found that
pkg_add is not looking at these files.

  Has anyone run into this issue? Any assumptions I am making? Any
  flawed logic in testing?
 
 I haven't tried to install packages in a jail lately but having
 written the USERS/GROUPS logic in bsd.port.mk, the package shouldn't
 need a ports tree to be installed properly.
 
Thanks!
jgh
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


issue with pkg_add

2010-10-19 Thread Jason Helfman

Hi,

I believe I may have come across a potential bug in pkg_add, but wanted
to write my findings out to see if anyone has seen this issue, or knows
of something I may be doing wrong.

I wrote a port that uses USERS/GROUPS functionality of ports.

USERS=  user
GROUPS= user_work
BINOWN= user
BINGRP= user_work
BINMODE=4110

These are the exec lines in my +CONTENTS file (assume one line for
each exec, they were wrapped):
@exec if ! /usr/sbin/pw groupshow user_work /dev/null 21;
then /usr/sbin/pw groupadd user_work -g 999; fi 
@exec if ! /usr/sbin/pw usershow user /dev/null 21;
then /usr/sbin/pw useradd user -u 999 -g 999  -c user -d /home/user
-s /usr/sbin/nologin; fi

I found that on my desktop with a ports tree installed that this port
and package installed with no issue, however I found that if I tried to
install the package in a jail with no ports tree and nothing installed
that it failed with this error:

pw: group `999' does not exist
pkg_add: command 'if ! /usr/sbin/pw usershow user /dev/null 21; then 
/usr/sbin/pw useradd user -u 999 -g 999  -c user -d /home/user -s 
/usr/sbin/nologin; fi' failed

I removed all remnants of the installation (these packages were all
successful builds in Tinderbox), including installed users/groups. I
copied my UIDs and GIDs files to an empty /usr/ports directory. So the
only files under /usr/ports were UIDs and GIDs.

With these files in place, I reran the pkg_add command on the port
package I created and it installed the user and group with no issue,
with correct permissions and modes on the files.

With this testing, it appears that pkg_add is looking
at /usr/ports/UIDs and /usr/ports/GIDs for information on installing a
port package, even-though all of the information required for an
installation appears to be in my port package.

Has anyone run into this issue? Any assumptions I am making? Any flawed
logic in testing?

Thanks,
Jason
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org