Bug 1983450 - BuildRequires += sfdisk (util-linux)
Summary: BuildRequires += sfdisk (util-linux)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1983449 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-18 16:42 UTC by Jason Vas Dias
Modified: 2021-07-20 11:12 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-07-20 07:55:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch to systemd.spec that fixes the problem by adding /usr/sbin to $PATH (1.22 KB, patch)
2021-07-18 16:55 UTC, Jason Vas Dias
no flags Details | Diff

Description Jason Vas Dias 2021-07-18 16:42:45 UTC
Description of problem:

Please add 
  BuildRequires: util-linux
to the spec file, since the test suite fails if this is not installed,
AND ensure that /usr/sbin is in $PATH for the build -
When I built with no /usr/sbin in my $PATH, as a non-root user
normally would , the build fails, with end-of-log :

"...
All done.
+ grep -v -e sector-size -e '^$'
+ sfdisk -d /tmp/test-repart.vpxHpruSQk/zzz
/home/jvd/rpmbuild/BUILD/systemd-stable-248.4/src/partition/test-repart.sh: line 20: sfdisk: command not found
+ rm -rf /tmp/test-repart.vpxHpruSQk
-------


Summary of Failures:

324/617 udev-test                                 SKIP           0.07s
331/617 test-repart                               FAIL           0.08s (exit status 1)
...


Version-Release number of selected component (if applicable):
248.4-1.fc34

How reproducible:
100%

Steps to Reproduce:
Try to rebuild SRPM as non-root user without /usr/sbin in $PATH .

Actual results:
Build fails.

Expected results:
Build should succeed.

Additional info:

Comment 1 Jason Vas Dias 2021-07-18 16:55:35 UTC
Created attachment 1803045 [details]
Patch to systemd.spec that fixes the problem by adding /usr/sbin to $PATH

Patch to systemd.spec that fixes the problem by adding /usr/sbin to $PATH
before tests are run .

Comment 2 Jason Vas Dias 2021-07-18 16:58:25 UTC
The attached systemd.spec patch (also with spec file patch for Bug 1983432)
fixes the problem, since it adds /usr/sbin to $PATH before tests are run.

Comment 3 Zbigniew Jędrzejewski-Szmek 2021-07-19 08:09:46 UTC
User paths as configured in Fedora already contain /usr/sbin. If that is removed, various
things will not work properly. Just don't do that.

BR:util-linux should be added, indeed.

Comment 4 Jason Vas Dias 2021-07-19 08:56:00 UTC
RE: > User paths as configured in Fedora already contain /usr/sbin. If that is removed, various
    > things will not work properly. Just don't do that.

But 'rpmbuild' does actually use the user's $PATH, which could be anything .

If your .spec file script depends for its success on some command being found
in $PATH , it should explicitly ensure that $PATH contains the directory -
at least a stanza like this should be in the spec file for the test run:
   if [[ ! "$PATH" =~ (^|:)/usr/sbin(:|$) ]]; then
      export PATH="${PATH}:/usr/sbin";
   fi

And actually, if you look at the bash defaults, the default path for
the root usr is:
    /bin:/sbin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
and for the non-root user is
    ${HOME}/bin:/usr/local/bin:/bin:/usr/bin

I run with my non-root PATH set in my .bashrc to be
    /usr/bin:/usr/local/bin:${HOME}/bin
and with my root path being:
    /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

(since /bin -> /usr/bin and /sbin -> /usr/sbin ).

The default path is configurable.

Spec file scripts cannot depend on rpm / rpmbuild having set some default path,
containing /usr/sbin - that does not happen.

Comment 5 Jason Vas Dias 2021-07-19 09:01:23 UTC
And also, the whole purpose putting programs into some */sbin directory rather than */bin
is that only the super-user is meant to be able to read or run files in the */sbin directory ;
otherwise, why not just put such programs in */bin ?

Comment 6 Zbigniew Jędrzejewski-Szmek 2021-07-20 07:55:02 UTC
https://src.fedoraproject.org/rpms/systemd/c/a6bdda479df8a3a4103648ab2fd2a94f032cdd62?branch=rawhide
adds sfdisk to BR.

> And also, the whole purpose putting programs into some */sbin directory rather than */bin
is that only the super-user is meant to be able to read or run files in the */sbin directory ;
otherwise, why not just put such programs in */bin ?

The split exists mostly for historical reasons. It is not possible to split programs into
those only invoked by an administrator and the rest in any meaningful way. We would get rid
of the split, but currently this is not possible because of consolehelper and the handful of
packages which use it.

Comment 7 Zbigniew Jędrzejewski-Szmek 2021-07-20 11:12:18 UTC
*** Bug 1983449 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.