Discussion:
update (-u) builds vs. copying read-only files
John D. Baker
2014-04-22 14:45:19 UTC
Permalink
While updating a build (unprivileged) that includes the "iso-image"
target, I saw the following:

[...]
Copying /d0/build/current/DEST/macppc/usr/mdec/ofwboot.xcf to /d0/build/current/obj/macppc/distrib/macppc/cdroms/installcd/cdrom ...
cp: /d0/build/current/obj/macppc/distrib/macppc/cdroms/installcd/cdrom/ofwboot.xcf: Permission denied
[...]

The directory in question:

$ ls -laF /d0/build/current/obj/macppc/distrib/macppc/cdroms/installcd/cdrom/
total 5112
drwxrwxr-x 3 sysop wsrc 512 Apr 21 15:32 ./
drwxrwxr-x 3 sysop wsrc 512 Apr 21 15:32 ../
drwxr-xr-x 4 sysop wsrc 512 Apr 22 07:46 macppc/
-rw-rw-r-- 1 sysop wsrc 2509068 Apr 22 07:54 netbsd
-r--r--r-- 1 sysop wsrc 70642 Apr 21 15:32 ofwboot.xcf

Since the previously-installed file is installed with mode "444", one
cannot overwrite it. Using 'cp -f' fixes the problem.

+Index: distrib/common/Makefile.bootcd
+===================================================================
+RCS file: /cvsroot/src/distrib/common/Makefile.bootcd,v
+retrieving revision 1.24
+diff -u -p -r1.24 Makefile.bootcd
+--- distrib/common/Makefile.bootcd 15 Feb 2014 09:43:02 -0000 1.24
++++ distrib/common/Makefile.bootcd 22 Apr 2014 14:02:49 -0000
+@@ -69,7 +69,7 @@ _CDMAKEFSOPTIONS= rockridge,label=${ISO_
+ .endif
+
+ # Stuff that should come from elsewhere - XXX where? - HF
+-CP?= cp
++CP?= cp -f
+ RM?= rm
+ MKDIR?= mkdir -p
+ CHMOD?= chmod

As the comment notes, if there are only a few arches that have issues
with copying read-only files to an installcd/bootcd, perhaps CP can
be defined in the arch-/machine-dependent Makefile before including
the common file?

For macppc:

+Index: distrib/macppc/cdroms/installcd/Makefile
+===================================================================
+RCS file: /cvsroot/src/distrib/macppc/cdroms/installcd/Makefile,v
+retrieving revision 1.2
+diff -u -p -r1.2 Makefile
+--- distrib/macppc/cdroms/installcd/Makefile 4 May 2010 14:09:11 -0000 1.2
++++ distrib/macppc/cdroms/installcd/Makefile 22 Apr 2014 14:09:31 -0000
+@@ -5,4 +5,7 @@ CDKERNELS= netbsd-INSTALL.gz netbsd
+ CDINSTKERNEL= ../../floppies/md-kernel
+ CDBUILDEXTRA= ${DESTDIR}/usr/mdec/ofwboot.xcf
+
++# Define copy program with options to force copy of readonly files
++CP?= cp -f
++
+ .include "${.CURDIR}/../../../common/Makefile.bootcd"
--
|/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
|\ / jdbaker[snail]mylinuxisp[flyspeck]com OpenBSD FreeBSD
| X No HTML/proprietary data in email. BSD just sits there and works!
|/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
Loading...