Fix switch_root/pivot_root cut-n-paste error in configure.ac
PATCH 1/1 Fix switch_root/pivot_root cut-n-paste error in configure.ac
The "linux only" check for pivot_root seems to suffer from a cut-n-paste problem from the earlier switch_root part.
--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
@@ -1193,7 +1193,7 @@ AC_ARG_ENABLE([pivot_root], [], [UL_DEFAULT_ENABLE([pivot_root], [check])] ) UL_BUILD_INIT([pivot_root]) -UL_REQUIRES_LINUX([switch_root]) +UL_REQUIRES_LINUX([pivot_root]) UL_REQUIRES_SYSCALL_CHECK([pivot_root], [UL_CHECK_SYSCALL([pivot_root])]) AM_CONDITIONAL([BUILD_PIVOT_ROOT], [test "x$build_pivot_root" = xyes])
Signature · 1 line
2.0.1
Quoted 2 lines · Andreas Henriksson
configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 13 lines · Andreas Henriksson
The "linux only" check for
pivot_rootseems to suffer from a cut-n-paste problem from the earlierswitch_rootpart.Signed-off-by Andreas Henriksson <[email protected]>--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure.ac +0
-0
configure.ac AC_ARG_ENABLE([pivot_root], · line 1196
Quoted 5 lines
configure.ac +1
-1@@ -1193,7 +1193,7 @@ AC_ARG_ENABLE([pivot_root], [], [UL_DEFAULT_ENABLE([pivot_root], [check])] ) UL_BUILD_INIT([pivot_root]) -UL_REQUIRES_LINUX([switch_root]) +UL_REQUIRES_LINUX([pivot_root])
Is this really correct? Seems to me like the check should simply be removed. In sys-utils/pivot_root.c, we have the following:
#define pivot_root(new_root,put_old) syscall(SYS_pivot_root,new_root,put_old)
So, the subsequent check for the syscall seems like the only necessary check needed. As is, I think that u-l now fails to build in places where the pivot_root wrapper doesn't exist in the libc, but the syscall exists (does such a platform even exist?).
Cheers,
dave
Quoted 10 lines
configure.ac +0
-0UL_REQUIRES_SYSCALL_CHECK([pivot_root], [UL_CHECK_SYSCALL([pivot_root])]) AM_CONDITIONAL([BUILD_PIVOT_ROOT], [test "x$build_pivot_root" = xyes])Signature · 6 lines
2.0.1 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello Dave Reisner!
Quoted 9 lines · Dave Reisner
Is this really correct? Seems to me like the check should simply be removed. In
sys-utils/pivot_root.c, we have the following:#define pivot_root(new_root,put_old) syscall(SYS_pivot_root,new_root,put_old)So, the subsequent check for the syscall seems like the only necessary check needed. As is, I think that u-l now fails to build in places where the
pivot_rootwrapper doesn't exist in the libc, but the syscall exists (does such a platform even exist?).
I cought this when trying to build on Debian GNU/kFreeBSD (with incorrect configure flags for that platform) where the SYS_pivot_root check failed the build.
Not knowing anything about non-linux architectures myself it was not obvious to me why this was.
Passing --disable-pivot_root fixed the build and it would be more obvious that this is the correct thing to do if it was pointed out that this is only expected to work on Linux.
I consider the UL_REQUIRES_LINUX check as a more obvious
way to point out this error so people like myself doesn't need to spend so much time scratching their heads over this.
Quoted 1 line
From what I can tell, Linux is the only system offering this syscall anyway.
Do you know of any non-linux system offering this? If not, then I think the check is still correct and helpful.
Regards,
Andreas Henriksson
Quoted 26 lines · Andreas Henriksson
Hello Dave Reisner!
Quoted 9 lines · Dave Reisner
Is this really correct? Seems to me like the check should simply be removed. In
sys-utils/pivot_root.c, we have the following:#define pivot_root(new_root,put_old) syscall(SYS_pivot_root,new_root,put_old)So, the subsequent check for the syscall seems like the only necessary check needed. As is, I think that u-l now fails to build in places where the
pivot_rootwrapper doesn't exist in the libc, but the syscall exists (does such a platform even exist?).I cought this when trying to build on Debian GNU/kFreeBSD (with incorrect configure flags for that platform) where the
SYS_pivot_rootcheck failed the build.
Not knowing anything about non-linux architectures myself it was not obvious to me why this was.Passing --disable-pivot_root fixed the build and it would be more obvious that this is the correct thing to do if it was pointed out that this is only expected to work on Linux.
I consider theUL_REQUIRES_LINUXcheck as a more obvious
way to point out this error so people like myself doesn't need to spend so much time scratching their heads over this.
Quoted 3 lines
From what I can tell, Linux is the only system offering this syscall anyway. Do you know of any non-linux system offering this?
If not, then I think the check is still correct and helpful.
Ah, I wrongly assumed what UL_REQUIRES_LINUX does. Makes more sense having now read the .m4 file, and I agree with your fix.
d
Karel Zak
maintainerQuoted 9 lines · Dave Reisner
Quoted 8 lines · Andreas Henriksson
The "linux only" check for
pivot_rootseems to suffer from a cut-n-paste problem from the earlierswitch_rootpart.Signed-off-by Andreas Henriksson <[email protected]>--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
configure.ac AC_ARG_ENABLE([pivot_root], · line 1196
Quoted 10 lines
configure.ac +1
-1@@ -1193,7 +1193,7 @@ AC_ARG_ENABLE([pivot_root], [], [UL_DEFAULT_ENABLE([pivot_root], [check])] ) UL_BUILD_INIT([pivot_root]) -UL_REQUIRES_LINUX([switch_root]) +UL_REQUIRES_LINUX([pivot_root])Is this really correct? Seems to me like the check should simply be removed.
It's definitely better to check that the system is Linux before you start to check for something more complicated. There is logical "and" between all UL_REQUIRES_*, so the first unsuccessful check disabled the rest.
Quoted 8 lines
In
sys-utils/pivot_root.c, we have the following:#define pivot_root(new_root,put_old) syscall(SYS_pivot_root,new_root,put_old)So, the subsequent check for the syscall seems like the only necessary check needed. As is, I think that u-l now fails to build in places where the
pivot_rootwrapper doesn't exist in the libc, but the syscall exists (does such a platform even exist?).
There is no glibc wrapper at all, in code we always call the syscall and in configure.ac we check for SYS_pivot_root sycall on Linux. Nowhere we care about libc.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Karel Zak
maintainerQuoted 2 lines · Dave Reisner
Ah, I wrongly assumed what
UL_REQUIRES_LINUXdoes. Makes more sense having now read the .m4 file, and I agree with your fix.
Yep, I have created UL_REQUIRES_ to have an elegant way how to specify dependences between --disable-* options, utils, libs (with in package) and external requirements. One day I'd like to write a blog about it ;-)
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com