Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBS Arch build seems to use different defaults for $PATH than Arch #713

Closed
e9925248 opened this issue Jun 18, 2014 · 6 comments
Closed

OBS Arch build seems to use different defaults for $PATH than Arch #713

e9925248 opened this issue Jun 18, 2014 · 6 comments

Comments

@e9925248
Copy link

Arch installs some perl programs instead of /usr/bin to /usr/bin/vendor_perl (eg. see https://www.archlinux.org/packages/community/any/po4a/ )
The Arch perl packages ships a helper script in /etc/profile.d, which adds /usr/bin/vendor_perl to the path.

Other PKGBUILD files can find programs in /usr/bin/vendor_perl just via $PATH (see https://www.archlinux.org/packages/community/any/man-pages-de/ for an example).

So the build process must somehow include /etc/profile - otherwise /usr/bin/vendor_perl would have never been part of the path.

On OBS this build fails: https://build.opensuse.org/package/live_build_log/home:e9925248/test1/Arch_Extra/i586

I created a small test build, which prints the $PATH (with the perl package present)
https://build.opensuse.org/package/live_build_log/home:e9925248/test/Arch_Extra/i586

@hennevogel
Copy link
Member

Why don't you call that helper during your build?

@mlschroe
Copy link
Member

The build script uses 'su -lc "makepkg ..."' to do the build, shouldn't that call the helper script in /etc/profile.d that adds /usr/bin/vendor_perl to the PATH?

@e9925248
Copy link
Author

e9925248 commented Jul 8, 2014

@hennevogel: The reason for filling this bug is not, that the build failed [a workaround in PKGBUILD is trivial], but that the Arch build environment on OBS seems to be different than the build enviroment used by the Arch people.

I did further investigations. The following commands in PKGBUILD
bash -lc 'echo $PATH'
bash -c 'echo $PATH'
produce the following output:
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl
/usr/bin

This means, that the build is started with "/usr/bin" as PATH, while /etc/profile would produce an extended path (including /usr/local/bin, /usr/local/sbin/..).

obs-build spawns "su -lc cd /usr/src/packages/SOURCES && makepkg --config ../makepkg.conf -ef abuild", which spawns "-bash -c cd /usr/src/packages/SOURCES && makepkg --config ../makepkg.conf -ef" as shell.
I have not found any trace in makepkg, that it would reset $PATH.
/etc/profile overwrites the path and this works with "bash -l".
su is spawning a login shell, because it calls "-bash".

My only hint is from shell.c from the bash sources:
/* A shell begun with the --login (or -l) flag that is not in posix mode
runs the login shell startup files, no matter whether or not it is
interactive. If NON_INTERACTIVE_LOGIN_SHELLS is defined, run the
startup files if argv[0][0] == '-' as well. */

So maybe "su -l" does not execute /etc/profile, because it spawn "-bash"

https://build.opensuse.org/build/home:e9925248/Arch_Extra/i586/test/_log

@e9925248
Copy link
Author

e9925248 commented Jul 8, 2014

openSuSE enables NON_INTERACTIVE_LOGIN_SHELLS:
https://build.opensuse.org/package/view_file/openSUSE:Factory/bash/bash-4.2.dif?expand=1

Arch does not patch bash, so it does not enable NON_INTERACTIVE_LOGIN_SHELLS:
https://projects.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/bash

So "su -l" might be not enough on Arch.

e9925248 added a commit to e9925248/obs-build that referenced this issue Jul 9, 2014
login shells started with "su -l" behave differently on Arch
(/etc/profile not executed):
openSUSE/open-build-service#713
@mlschroe
Copy link
Member

Ok, that explains it. What were the bash guys smoking? Sourcing /etc/profile for login shells is the standard unix behavior. (Seems like Debian/Fedora/SUSE all define NON_INTERACTIVE_LOGIN_SHELLS to fix this.)

@mlschroe
Copy link
Member

I merged your obs-build pull request, closing this issue... Thanks for investigating this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants