Luke Mewburn | 3 May 2002 03:16

Re: UNPRIVED & DESTDIR

On Tue, Apr 23, 2002 at 03:02:47PM +0100, Richard Earnshaw wrote:
  | Hmm, it seems that the build system doesn't fault attempts to do an 
  | UNPRIVED build into /, at least, it still continues to pass the options to 
  | install to update the METALOG file.
  | 
  | Does install still attempt to correctly set the install flags in this 
  | case, or should the Makefiles be altered to fault this case?
  | 
  | Is there any way to force a privileged re-install into / after an unprived 
  | build?  UNPRIVED is only tested for being defined, not for its value, so 
  | it isn't possible to override the setting through the nbmake-wrapper prog.

If you've built UNPRIVED into a DESTDIR, you can use something like
the following to copy all the files under DESTDIR into / except for
those in ./etc and ./var, retaining the privileges:

	# cd $DESTDIR
	# ( cat etc/mtree/NetBSD.dist $MAKEOBJDIRPREFIX/usr/src/METALOG ) | \
	    sed -e "s,^.$DESTDIR,.,' | \
	    egrep -v '^./(etc|var)/' | \
	    nbpax -rwMvpe /

(change the path to the METALOG as appropriate)

Of course, your mileage may vary, use at your own risk, (...)

Luke.

David Laight | 3 May 2002 10:09
Picon

Re: UNPRIVED & DESTDIR

On Fri, May 03, 2002 at 11:16:09AM +1000, Luke Mewburn wrote:
> 
> If you've built UNPRIVED into a DESTDIR, you can use something like
> the following to copy all the files under DESTDIR into / except for
> those in ./etc and ./var, retaining the privileges:
> 
> 	# cd $DESTDIR
> 	# ( cat etc/mtree/NetBSD.dist $MAKEOBJDIRPREFIX/usr/src/METALOG ) | \
> 	    sed -e "s,^.$DESTDIR,.,' | \
> 	    egrep -v '^./(etc|var)/' | \
> 	    nbpax -rwMvpe /

That won't work - the privileges are not set during an UNPRIVED
build.

You need to use the contents of the METALOG file to set them.
Also (unless it has been fixed since last time I updated my source)
you will find that all the .a libraries have the wrong permissions.
(Which stops any further builds...)

I've attached the script I used.

	David

--

-- 
David Laight: david <at> l8s.co.uk
#!/bin/sh

(Continue reading)

Luke Mewburn | 3 May 2002 10:47

Re: UNPRIVED & DESTDIR

On Fri, May 03, 2002 at 09:09:38AM +0100, David Laight wrote:
  | On Fri, May 03, 2002 at 11:16:09AM +1000, Luke Mewburn wrote:
  | > 
  | > If you've built UNPRIVED into a DESTDIR, you can use something like
  | > the following to copy all the files under DESTDIR into / except for
  | > those in ./etc and ./var, retaining the privileges:
  | > 
  | > 	# cd $DESTDIR
  | > 	# ( cat etc/mtree/NetBSD.dist $MAKEOBJDIRPREFIX/usr/src/METALOG ) | \
  | > 	    sed -e "s,^.$DESTDIR,.,' | \
  | > 	    egrep -v '^./(etc|var)/' | \
  | > 	    nbpax -rwMvpe /
  | 
  | That won't work - the privileges are not set during an UNPRIVED
  | build.
  | 
  | You need to use the contents of the METALOG file to set them.
  | Also (unless it has been fixed since last time I updated my source)
  | you will find that all the .a libraries have the wrong permissions.
  | (Which stops any further builds...)

I *know* that we need to use the contents of the METALOG file to
set the appropriate privileges because the files in $DESTDIR don't
have them.  That is what the snippet above does.  Who do you think
got most of the UNPRIVED and METALOG support working in "make release" ? 
(Hint: I did).  Please read the manual page in NetBSD-current for pax(1),
specifically the section about what '-M' does.

I understand that you're trying to be helpful, but please check your
facts before jumping in and making authoratitive statements about what
(Continue reading)

Simon Burge | 12 May 2002 03:14

alpha target, i386 host problems

Folks,

I've been having a play around with using an alpha target for
cross-building using an i386 host.  I've found a simple test case:

	athlon 434> cat yyy.c
	void foo(void) { char bar[] = "a"; }
	athlon 435> /l/tools/bin/alpha--netbsd-gcc -O0 -c yyy.c -da
	yyy.c: In function `foo':
	yyy.c:1: internal error--unrecognizable insn:

	(insn 13 11 15 (set (reg:DI 77)
		(and:DI (plus:DI (reg:DI 70)
			(const_int 584778145450688512 [0x81d8ca000000000]))
		    (const_int -8 [0xfffffffffffffff8]))) -1 (nil)
	    (nil))

The first difference in the RTL dumps between an alpha hosted toolchain
and an i386 hosted toolchain is:

--- alpha/yyy.c.rtl     Sun May 12 10:04:37 2002
+++ i386/yyy.c.rtl      Sun May 12 10:04:47 2002
 <at>  <at>  -21,31 +21,40  <at>  <at> 
     (expr_list:REG_EQUAL (symbol_ref:DI ("*$LC0"))
         (nil)))

-(insn 13 11 15 (set (reg:DI 72)
-        (mem/s/u:DI (and:DI (reg:DI 70)
-                (const_int -8 [0xfffffffffffffff8])) 0)) -1 (nil)
+(insn 13 11 15 (set (reg:DI 77)
(Continue reading)

Todd Vierling | 13 May 2002 16:20

Re: UNPRIVED & DESTDIR

On Fri, 3 May 2002, Luke Mewburn wrote:

: (For what it's worth, rather than writing a script to parse the
: METALOG, you can use mtree(8) -D with a little bit of awk magic to
: replace the majority of what you've done.)

Wouldn't "pax -r -w -pe -M ..." do the job too?  :)

(mmm, pax copy-preserve)

--

-- 
-- Todd Vierling <tv <at> wasabisystems.com>  *  Wasabi & NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/

David Laight | 13 May 2002 18:26
Picon

Re: UNPRIVED & DESTDIR

On Mon, May 13, 2002 at 10:20:35AM -0400, Todd Vierling wrote:
> On Fri, 3 May 2002, Luke Mewburn wrote:
> 
> : (For what it's worth, rather than writing a script to parse the
> : METALOG, you can use mtree(8) -D with a little bit of awk magic to
> : replace the majority of what you've done.)
> 
> Wouldn't "pax -r -w -pe -M ..." do the job too?  :)

No because:

1) the files in DESTDIR for an UNPRIVED build do not have the
   permissions applied (because you wouldn't be able to overwrite them,
   and some need to be suid root, not suid build-user).
2) the filenames in METALOG are all preceeded by the absolute
   pathname of DESTDIR.

Well, when I wrote the scrite Luke hadn't made the version of mtree
that handles all the entry types genarally available....
I don't rmember seeing a cross reference to pax when reading
the man pages either :-(
(but the copy I had access to wouldn't have handles the METALOG
files from build either).

I've also got a script to merge two (sorted) metalog files...

FWIW there is still a bug in the METALOG file - the permissions
for archive libraries are incorrect [1].  pax won't find this
because it leaves the existing permissions on existing files.

(Continue reading)

Todd Vierling | 13 May 2002 19:33

Re: UNPRIVED & DESTDIR

On Mon, 13 May 2002, David Laight wrote:

: > : (For what it's worth, rather than writing a script to parse the
: > : METALOG, you can use mtree(8) -D with a little bit of awk magic to
: > : replace the majority of what you've done.)
: >
: > Wouldn't "pax -r -w -pe -M ..." do the job too?  :)
:
: No because:
:
: 1) the files in DESTDIR for an UNPRIVED build do not have the
:    permissions applied (because you wouldn't be able to overwrite them,
:    and some need to be suid root, not suid build-user).

Er, you'd "pax -r -w -pe" from $DESTDIR to /.  There's a copy involved.
This copy (done as root, of course), if taking into account the metalog,
should produce proper permissions on the binaries installed into /.

: 2) the filenames in METALOG are all preceeded by the absolute
:    pathname of DESTDIR.

Sed script.

--

-- 
-- Todd Vierling <tv <at> wasabisystems.com>  *  Wasabi & NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/

Luke Mewburn | 14 May 2002 01:11

Re: UNPRIVED & DESTDIR

On Mon, May 13, 2002 at 05:26:22PM +0100, David Laight wrote:
  | FWIW there is still a bug in the METALOG file - the permissions
  | for archive libraries are incorrect [1].  pax won't find this
  | because it leaves the existing permissions on existing files.
  | 
  | [1] IIRC the files are installed with 0600 permissions, ranlib
  | is run, then the requested permissions applied - probably to
  | ensure ranlib has write access.

Please ensure that your source tree is up to date before making
assertions about bugs in the system, especially the build system.

That particular problem was solved on March 19 (2002/03/19) in
revision 1.198 of share/mk/bsd.lib.mk.  I've built many full
UNPRIVED releases since that fix and the permissions are correct.

If you notice problems like this on a fresh up to date source tree,
please use send-pr to report the problem at the time.

--
Luke Mewburn  <lukem <at> wasabisystems.com>  http://www.wasabisystems.com
Luke Mewburn     <lukem <at> netbsd.org>      http://www.netbsd.org
Wasabi Systems - NetBSD hackers for hire
NetBSD - the world's most portable UNIX-like operating system

David Laight | 14 May 2002 01:41
Picon

Re: UNPRIVED & DESTDIR

On Tue, May 14, 2002 at 09:11:25AM +1000, Luke Mewburn wrote:
> On Mon, May 13, 2002 at 05:26:22PM +0100, David Laight wrote:
>   | FWIW there is still a bug in the METALOG file - the permissions
>   | for archive libraries are incorrect [1].  pax won't find this
>   | because it leaves the existing permissions on existing files.
>   | 
>   | [1] IIRC the files are installed with 0600 permissions, ranlib
>   | is run, then the requested permissions applied - probably to
>   | ensure ranlib has write access.
> 
> Please ensure that your source tree is up to date before making
> assertions about bugs in the system, especially the build system.
> 
> That particular problem was solved on March 19 (2002/03/19) in
> revision 1.198 of share/mk/bsd.lib.mk.  I've built many full
> UNPRIVED releases since that fix and the permissions are correct.
> 
> If you notice problems like this on a fresh up to date source tree,
> please use send-pr to report the problem at the time.

Looks like I last updated on March 14!  Didn't realise it was quite
that long ago :-(
OK I didn't send-pr it when I found it (back in Feb), but did mail
one of the tech- newsgroups.....
Given you were still playing with the code at that time I'd
thought a note to the ng would suffice.

Never mind :-)

	David
(Continue reading)

Aravind Gottipati | 14 May 2002 05:48
Picon

problem with fts.h while building toolkit on linux

Hi,
    I am trying to cross build netbsd on a linux box.  I downloaded the
latest sources from pub/NetBSD/NetBSD-current/tar_files/src/.  I am
getting this error message when I try to build the tool kit.

This is what I tried from the src directory.  

./build.sh -m i386 -t

cc -O  -I. -I./include -I/home/aravind/tmp/netbsd/src/tools/compat
-DHAVE_CONFIG_H  -D_FILE_OFFSET_BITS=64 -D__DBINTERFACE_PRIVATE -c -o
__fts13.lo.o
/home/aravind/tmp/netbsd/src/tools/compat/../../lib/libc/gen/__fts13.c
In file included from
/home/aravind/tmp/netbsd/src/tools/compat/../../lib/libc/gen/__fts13.c:53:
/usr/include/fts.h:41: #error "<fts.h> cannot be used with
-D_FILE_OFFSET_BITS==64"
*** Error code 1

Stop.
nbmake: stopped in /home/aravind/tmp/netbsd/src/tools/compat
*** Error code 1

Stop.
nbmake: stopped in /home/aravind/tmp/netbsd/src/tools/compat
*** Error code 1

Stop.
nbmake: stopped in /home/aravind/tmp/netbsd/src/tools

(Continue reading)


Gmane