[arch-general] [PATCH] devtools: give a writable home to nobody for use in makechrootpkg
Hi, This is to ensure $HOME is a writable directory during makechrootpkg runs. I suspect this is helpful to build various packages - in the example I have in mind (uim in [extra]), the home directory was determined by getpwuid(getuid())->pw_dir, so simply exporting a new HOME environment variable in the PKGBUILD wasn't enough. Best, --Gaetan diff -aur devtools-0.9.9/mkarchroot devtools-0.9.9.new/mkarchroot --- devtools-0.9.9/mkarchroot 2010-08-20 12:44:16.000000000 +0200 +++ devtools-0.9.9.new/mkarchroot 2010-08-23 11:11:45.036666760 +0200 @@ -194,5 +194,9 @@ if [ ! -e "${working_dir}/.arch-chroot" ]; then date +%s > "${working_dir}/.arch-chroot" fi + + # give nobody a writable home (for makechrootpkg) + chroot "${working_dir}" usermod -d /build nobody + # }}} fi
On Mon, 23 Aug 2010 11:21:20 +0200, Gaetan Bisson <bisson@archlinux.org> wrote:
Hi,
This is to ensure $HOME is a writable directory during makechrootpkg runs. I suspect this is helpful to build various packages - in the example I have in mind (uim in [extra]), the home directory was determined by getpwuid(getuid())->pw_dir, so simply exporting a new HOME environment variable in the PKGBUILD wasn't enough.
I would say if a build or package function tries to write file in a user's home directory it should be considered broken and the PKGBUILD should be fixed. -- Pierre Schmitz, https://users.archlinux.de/~pierre
[2010-08-23 16:46:09 +0200] Pierre Schmitz:
On Mon, 23 Aug 2010 11:21:20 +0200, Gaetan Bisson <bisson@archlinux.org> wrote:
This is to ensure $HOME is a writable directory during makechrootpkg runs. I suspect this is helpful to build various packages - in the example I have in mind (uim in [extra]), the home directory was determined by getpwuid(getuid())->pw_dir, so simply exporting a new HOME environment variable in the PKGBUILD wasn't enough.
I would say if a build or package function tries to write file in a user's home directory it should be considered broken and the PKGBUILD should be fixed.
I completely agree that it's broken to write to $HOME at build time. Nevertheless, when a package does that and uses getpwuid() to determine the home directory, there is no way that I know of to deal with this solely in the PKGBUILD: the source must be patched, for instance to use getent("HOME") rather than getpwuid(), which is, in my opinion, not as satisfying a fix as simply setting ~nobody to /build. That said, well, both fixes work... :) -- Gaetan
On 23/08/10 16:39, Gaetan Bisson wrote:
[2010-08-23 16:46:09 +0200] Pierre Schmitz:
On Mon, 23 Aug 2010 11:21:20 +0200, Gaetan Bisson <bisson@archlinux.org> wrote:
This is to ensure $HOME is a writable directory during makechrootpkg runs. I suspect this is helpful to build various packages - in the example I have in mind (uim in [extra]), the home directory was determined by getpwuid(getuid())->pw_dir, so simply exporting a new HOME environment variable in the PKGBUILD wasn't enough.
I would say if a build or package function tries to write file in a user's home directory it should be considered broken and the PKGBUILD should be fixed.
I completely agree that it's broken to write to $HOME at build time.
Nevertheless, when a package does that and uses getpwuid() to determine the home directory, there is no way that I know of to deal with this solely in the PKGBUILD: the source must be patched, for instance to use getent("HOME") rather than getpwuid(), which is, in my opinion, not as satisfying a fix as simply setting ~nobody to /build.
That said, well, both fixes work... :)
Is this *really* bad, in fact so bad that upstream should be told about it, since it doesn't only affect packagers? (AFAICS the build system provided by upstream only works for individual users installing a personal build.) Has this already been communicated to upstream? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
[2010-08-23 19:15:13 +0100] Magnus Therning:
Is this *really* bad, in fact so bad that upstream should be told about it, since it doesn't only affect packagers? (AFAICS the build system provided by upstream only works for individual users installing a personal build.)
It's not that bad: at build time, after the main binary has been built, it is run to generate a configuration file - and this binary happens to always create ~/.program.d/ when it doesn't exist. Now, during the build process, this directory is never actually used and remains empty until the end of it (so you can build as nobody and then install system-wide). I really can't blame them for assuming $HOME is writable (both normally, and at build time, since it simplifies their build process); I see this as a rather unfortunate interaction with makechrootpkg. -- Gaetan
On 23/08/10 19:53, Gaetan Bisson wrote:
[2010-08-23 19:15:13 +0100] Magnus Therning:
Is this *really* bad, in fact so bad that upstream should be told about it, since it doesn't only affect packagers? (AFAICS the build system provided by upstream only works for individual users installing a personal build.)
It's not that bad: at build time, after the main binary has been built, it is run to generate a configuration file - and this binary happens to always create ~/.program.d/ when it doesn't exist. Now, during the build process, this directory is never actually used and remains empty until the end of it (so you can build as nobody and then install system-wide).
I would still argue that it's completely bonkers behaviour! I would *never* expect that building a piece of software would modify my $HOME. I've also never ever heard of such behaviour before.
I really can't blame them for assuming $HOME is writable (both normally, and at build time, since it simplifies their build process); I see this as a rather unfortunate interaction with makechrootpkg.
I blame them for writing in $HOME! From the sounds of it they are just lazy; there should be a command line switch to control whether the directory (~/.program.d/) is created. Anyway, I can understand *your* actions: modifying Arch stuff so that you can build in a chroot rather than apply a patch to the source. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
participants (3)
-
Gaetan Bisson
-
Magnus Therning
-
Pierre Schmitz