Repository navigation
Conversation
This was always undesirable but now causes problems on Fedora 42 where at build time we detect a /sbin path but at runtime this will only exist on upgraded machines, not fresh installs. Signed-off-by: Daniel P. Berrangé <[email protected]>
This is redundant since the tests will strip any path component from the binary name before comparison. Signed-off-by: Daniel P. Berrangé <[email protected]>
Change the meson rules to always enable numad if on a Linux host, unless the meson options say not to. Signed-off-by: Daniel P. Berrangé <[email protected]>
Change the meson rules to always enable numad if on a FreeBSD host, unless the meson options say not to. Signed-off-by: Daniel P. Berrangé <[email protected]>
Change the source to assume use of 'ifconfig' on FreeBSD builds, allowing virCommand to report missing commands at runtime. Signed-off-by: Daniel P. Berrangé <[email protected]>
Nothing in the tree references RST2MAN or RST2HTML5 variables, only rst2man_prog & rst2html5_prog, so the former can be removed. Signed-off-by: Daniel P. Berrangé <[email protected]>
Currently $(PERL) is expanding to nothing, but the spacing-check.pl test luckily still works via the shebang. Signed-off-by: Daniel P. Berrangé <[email protected]>
There is no reference to PERL, PYTHON3, XMLLINT or XSLTPROC conf
variables anywhere, only the ${name}_prog meson variables are
used.
Signed-off-by: Daniel P. Berrangé <[email protected]>
Allow virCommand to find 'dmidecode' in $PATH. This command is only usable when running privileged since it relies on reading from a privileged kernel file. Thus we can assume both 'bin' and 'sbin' dirs will be in $PATH and virFindFileInPath will do the right thing to find it when called by virCommand. Signed-off-by: Daniel P. Berrangé <[email protected]>
There are no references to an "IP" conf variable nor a meson 'ip_prog' variable so the check serves no purpose. Signed-off-by: Daniel P. Berrangé <[email protected]>
Gating the iscsi driver backend on a isciadm probe is likely to do more harm than good as it needlessly disables the code if the dev forgot to install iscsiadm at build time. As a Linux only command it is simpler to gate the feature based on the platform choice and allow missing binaries to be diagnose at runtime. Signed-off-by: Daniel P. Berrangé <[email protected]>
Allow virCommand to find 'mdevctl' in $PATH. This command is only used when running privileged in which case both 'bin' and 'sbin' dirs will be in $PATH, so virFindFileInPath will do the right thing to find it. Signed-off-by: Daniel P. Berrangé <[email protected]>
Allow virCommand to find 'mm-ctl' in $PATH. This command is only used when running privileged in which case both 'bin' and 'sbin' dirs will be in $PATH, so virFindFileInPath will do the right thing to find it. Signed-off-by: Daniel P. Berrangé <[email protected]>
Allow virCommand to find 'modprobe' & 'rmmod' in $PATH. These commands are only used when running privileged in which case both 'bin' and 'sbin' dirs will be in $PATH, so virFindFileInPath will do the right thing to find them. Signed-off-by: Daniel P. Berrangé <[email protected]>
Allow virCommand to find 'ovs-vsctl' in $PATH. This command is only used when running privileged in which case both 'bin' and 'sbin' dirs will be in $PATH, so virFindFileInPath will do the right thing to find it. Signed-off-by: Daniel P. Berrangé <[email protected]>
Allow virCommand to find 'tc' in $PATH. This command is only used when running privileged in which case both 'bin' and 'sbin' dirs will be in $PATH, so virFindFileInPath will do the right thing to find it. Signed-off-by: Daniel P. Berrangé <[email protected]>
There is no reference to AUGPARSE, BLACK, FLAKE8, PDWTAGS or PYTEST conf
variables anywhere, only the ${name}_prog meson variables are used.
Signed-off-by: Daniel P. Berrangé <[email protected]>
Change the mesonm rules to always enable the LVM driver if on a Linux host, unless the meson options say not to. The virCommand APIs will return suitable runtime errors if the tools are not installed. Signed-off-by: Daniel P. Berrangé <[email protected]>
Allow virCommand to find it in $PATH Signed-off-by: Daniel P. Berrangé <[email protected]>
Allow virCommand to find them in $PATH, which will always include 'sbin' since the openvz driver only operates in system mode. Signed-off-by: Daniel P. Berrangé <[email protected]>
Reviewer's GuideThis pull request modifies the build system (meson.build) to remove the detection and hardcoding of absolute paths for external helper programs at build time. C code is updated to invoke these programs directly by name, relying on runtime $PATH lookups, and test expectations are adjusted accordingly. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
WalkthroughThis set of changes systematically replaces macro-based or hardcoded absolute paths for system utilities and commands with direct use of string literals representing the command names throughout the codebase. The build system scripts are updated to simplify and standardize how external tools are detected and referenced, often removing redundant checks and consolidating logic for platform-specific features. Several macros defining command paths are eliminated, and their usage in both production and test code is replaced with explicit string literals. Some build configuration logic is also streamlined, particularly regarding platform requirements and driver enablement. A new macro for the Changes
Sequence Diagram(s)sequenceDiagram
participant BuildSystem
participant Environment
participant ExternalTool
BuildSystem->>Environment: Detect tool (e.g., "perl", "tc", "lvs", etc.)
Environment-->>BuildSystem: Return tool path or default to command name
BuildSystem->>ExternalTool: Invoke tool using string literal name
ExternalTool-->>BuildSystem: Execute and return result
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@CodiumAI-Agent /review |
There was a problem hiding this comment.
Hey @berrange - I've reviewed your changes - here's some feedback:
- The build now assumes presence of tools like 'iscsiadm' or LVM commands at runtime on Linux instead of checking at build time; confirm this change in verification strategy.
- Review the new OS-specific conditions in meson.build and C code to ensure they correctly handle all supported platforms.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (10)
src/storage/storage_backend_logical.c (10)
73-76:pvremoveliteral – same observation as above
Same reasoning as for the previous block; nothing further to address.
103-105:pvcreateliteral – same observation
383-392:lvsliteral – same observation
487-489:vgscanliteral – same observation
490-497:pvsliteral – same observation
662-663:vgcreateliteral – same observation
723-731:vgsliteral – same observation
772-776:vgremoveliteral – same observation
798-800:lvchange/lvremoveliterals – same observation
828-839:lvcreateliteral – same observation
🧹 Nitpick comments (3)
meson.build (3)
1478-1481: Bhyve driver now enabled solely by host OSDropping the explicit search for
bhyve*binaries means a FreeBSD build will succeed even if the hypervisor tools are absent, deferring any failure to runtime.
Please consider:- conf.set('WITH_BHYVE', 1) + # Ensure bhyve tooling is present at build-time to fail early + if find_program('bhyve', required: false).found() and + find_program('bhyvectl', required: false).found() + conf.set('WITH_BHYVE', 1) + elif get_option('driver_bhyve').enabled() + error('bhyve tools (bhyve, bhyvectl) not found') + endifFail-early avoids surprising runtime errors on mis-configured builders.
1815-1820: iSCSI driver check may mis-leadThe compile-time check for
iscsiadmwas removed, but the error still says “using iscsiadm”. This can confuse users.- error('Linux host needed for iSCSI storage driver using iscsiadm') + error('Linux host needed for iSCSI storage driver; ensure iscsiadm is available at runtime')
1829-1835: LVM driver build-time check removedSame concern as with iSCSI: the driver now builds on any Linux system, even if LVM utilities are missing. A short hint in the error (or summary) that the tools must exist at runtime would help packagers diagnose failures.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (26)
build-aux/Makefile.in(1 hunks)build-aux/meson.build(1 hunks)docs/meson.build(0 hunks)meson.build(6 hunks)src/bhyve/bhyve_command.c(3 hunks)src/locking/lock_driver_lockd.c(2 hunks)src/node_device/node_device_driver.c(5 hunks)src/openvz/openvz_conf.h(1 hunks)src/storage/storage_backend_fs.c(3 hunks)src/storage/storage_backend_logical.c(10 hunks)src/util/virfirewall.h(1 hunks)src/util/viriscsi.c(12 hunks)src/util/virkmod.c(2 hunks)src/util/virnetdevbandwidth.c(16 hunks)src/util/virnetdevip.c(5 hunks)src/util/virnetdevmidonet.c(2 hunks)src/util/virnetdevopenvswitch.c(2 hunks)src/util/virnuma.c(1 hunks)src/util/virpolkit.c(2 hunks)src/util/virpolkit.h(0 hunks)src/util/virsysinfo.c(2 hunks)tests/storagepoolxml2argvtest.c(1 hunks)tests/viriscsitest.c(6 hunks)tests/virkmodtest.c(2 hunks)tests/virnetdevbandwidthtest.c(1 hunks)tests/virnetdevopenvswitchtest.c(3 hunks)
💤 Files with no reviewable changes (2)
- src/util/virpolkit.h
- docs/meson.build
🔇 Additional comments (60)
src/openvz/openvz_conf.h (1)
32-34: Rely on PATH for locating OpenVZ utilities
Removing the hardcoded/usr/sbin/prefix correctly defers command resolution to the runtimePATH. Please verify that any execution context (daemons, tests, wrappers) includes/sbinand/usr/sbininPATHso these invocations ofvzlist,vzctl, andvzmigratewill resolve reliably.src/util/virfirewall.h (1)
33-33: Addition ofTCmacro is appropriate
Defining#define TC "tc"extends the set of firewall tools to include the traffic control utility. This mirrors the existing pattern for other tools and correctly integrates the new layer.src/util/virsysinfo.c (2)
896-898: Consistent replacement ofDMIDECODEmacro
Switching from theDMIDECODEconstant to the literal"dmidecode"invirSysinfoDMIDecodeOEMStringmaintains identical behavior and aligns with the PR’s goal to standardize command names.
1202-1202: Standardizing DMI command invocation
Replacing theDMIDECODEmacro with"dmidecode"invirSysinfoReadDMIis consistent and preserves functionality.src/util/virnetdevmidonet.c (2)
46-46: Literal replacement forMM_CTLis correct
Using"mm-ctl"directly invirNetDevMidonetBindPortimproves clarity and fits the refactoring pattern.
76-76: Consistent use of literal command name
The"mm-ctl"string invirNetDevMidonetUnbindPortmirrors the bind-port change, ensuring uniformity.build-aux/Makefile.in (1)
9-9: AddPERLvariable for Makefile substitutions
DefiningPERL = @PERL@complements the Meson configuration and ensures the Makefile can reference the Perl interpreter path at build time.src/util/virkmod.c (2)
32-32: Replaced hardcoded binary path with command nameCommand string literals are used now instead of macros, allowing the system to find commands through standard PATH lookup at runtime.
51-51: Replaced hardcoded binary path with command nameUsing string literal "rmmod" instead of a macro is consistent with the project's goal to stop hardcoding paths at build time.
src/bhyve/bhyve_command.c (3)
714-714: Replaced hardcoded binary path with command nameUsing "bhyve" string directly instead of the BHYVE macro aligns with the goal of stopping path hardcoding at build time.
887-887: Replaced hardcoded binary path with command nameThe string literal "bhyvectl" now directly replaces the BHYVECTL macro, allowing for PATH-based command resolution.
910-910: Replaced hardcoded binary path with command nameChanged from macro BHYVELOAD to string literal "bhyveload", consistent with other similar changes in this file.
src/node_device/node_device_driver.c (6)
747-747: Replaced hardcoded binary path with command nameUsing "mdevctl" string literal instead of MDEVCTL macro for command creation.
754-755: Replaced hardcoded binary path with command nameConsistent change to use string literal for the mdevctl command.
904-911: Replaced hardcoded binary path with command nameUsing string literal "mdevctl" for command creation with multiple arguments.
1133-1137: Replaced hardcoded binary path with command nameUsing string literal instead of macro for mdevctl command creation in autorestart settings.
1179-1182: Replaced hardcoded binary path with command nameUsing string literal instead of macro for mdevctl list command creation.
1897-1898: Replaced hardcoded binary path with command nameUpdated error message to use string literal "mdevctl" instead of the MDEVCTL macro.
src/storage/storage_backend_fs.c (3)
307-307: Replaced hardcoded binary path with command nameUsing "mount" string directly instead of MOUNT macro, which simplifies command invocation and allows for PATH-based resolution.
365-365: Replaced hardcoded binary path with command nameChanged from UMOUNT macro to explicit "umount" string literal for command creation.
405-405: Replaced hardcoded binary path with command nameUsing "mkfs" string literal directly instead of a macro or path lookup. This simplifies the code and allows the system to find the command through the standard PATH.
src/util/virpolkit.c (2)
192-192: Good change for PATH-based command lookup.This change from using a macro
PKTTYAGENTto a direct string literal"pkttyagent"aligns with the PR objective of eliminating hardcoded binary paths at build time.
237-244: Proper implementation of dynamic binary discovery.The changes to
virPolkitAgentAvailable()properly implement dynamic binary resolution usingvirFindFileInPath()instead of relying on a hardcoded path. This improves compatibility with systems where/sbinand/usr/binare merged, like in Fedora 42.src/util/virnuma.c (1)
64-64: Good replacement of macro with string literal command name.Replacing the
NUMADmacro with the direct string literal"numad"ensures the command is found using PATH lookup at runtime rather than using hardcoded paths from build time.src/locking/lock_driver_lockd.c (2)
436-436: Improved platform specificity with Linux check.Changing from
#ifdef LVSto#ifdef __linux__makes the platform requirement more explicit and clear, which is a better practice than using a feature-based macro that might be confusing.
449-453: Good change for PATH-based command lookup.Replacing the
LVSmacro with the string literal"lvs"follows the pattern of eliminating hardcoded paths. This improves compatibility across different Linux distributions with varying filesystem layouts.tests/viriscsitest.c (1)
85-85: Test code properly updated to match implementation changes.All instances where
ISCSIADMmacro was used in string comparisons have been replaced with the direct string literal"iscsiadm", ensuring the test code remains in sync with the implementation changes that eliminate hardcoded paths.Also applies to: 93-93, 104-104, 124-124, 131-131, 145-145, 163-163, 175-175
src/util/viriscsi.c (5)
91-92: Refactor uses direct command name instead of macroThis change replaces the
ISCSIADMmacro with the literal string"iscsiadm". The virCommand API will now search for the command in the system's PATH instead of using a hardcoded path.
126-127: Consistent approach using non-absolute command pathsUsing the command name directly rather than a macro with a hardcoded path improves compatibility with systems where binary locations may vary.
196-197: Updated error messages to use direct command nameError messages now reference the command directly as
iscsiadmrather than using a macro that might expand to an absolute path.Also applies to: 228-229, 246-247, 530-531
274-275: String literal replaces macro in command arrayReplaced
ISCSIADMmacro with the string literal"iscsiadm"in the command array for consistency.
345-349: Command instantiation using string literal instead of macroThese additional instances follow the same pattern of replacing
ISCSIADMmacro with the string literal"iscsiadm".Also applies to: 398-402, 514-514, 548-548
src/util/virnetdevbandwidth.c (5)
129-129: Replaced TC macro with direct command nameMultiple instances of
virCommandNew(TC)have been changed tovirCommandNew("tc")to use PATH-based command resolution rather than hardcoded paths.Also applies to: 141-141, 337-337, 346-346, 362-362, 372-372, 400-400, 408-408
451-451: Direct command name for qdisc operationsUsing string literals for the command name facilitates proper command resolution across different system configurations.
Also applies to: 457-457
596-596: Replaced macro with command name for bandwidth plug/unplug operationsConsistent replacement of the
TCmacro with the string literal"tc"across bandwidth management functions.Also applies to: 605-605, 647-647, 660-660, 701-701
775-776: ArgList version of command with string literalUsing a direct string literal in
virCommandNewArgListis consistent with the pattern used throughout the file.
814-814: Updated test and root qdisc commands with direct string literalsCommand creation for testing and adding root qdisc now uses the command name directly rather than a macro.
Also applies to: 829-829
src/util/virnetdevopenvswitch.c (2)
59-59: OVS command creation uses direct command nameReplaced
OVS_VSCTLmacro with the string literal"ovs-vsctl"for command creation.
555-555: Path lookup uses command name instead of macro
virFindFileInPathnow searches for"ovs-vsctl"directly in PATH rather than using a potentially hardcoded macro value.tests/virkmodtest.c (2)
66-66: Test expectation updated to use direct command nameChanged test output verification to check for
"modprobe"instead of using theMODPROBEmacro, which matches the implementation changes.
88-88: Unload test uses direct command nameUpdated expected output check to use string literal
"rmmod"instead of theRMMODmacro for consistency with implementation changes.tests/storagepoolxml2argvtest.c (2)
41-41: Command path hardcoding replaced with command nameThe code now uses the string literal "mount" instead of a potentially hardcoded path macro (MOUNT), which aligns with the PR objective of eliminating hardcoded binary paths at build time.
46-46: Command path hardcoding replaced with command nameThe code now uses the string literal "vgchange" instead of a potentially hardcoded path macro (VGCHANGE), which aligns with the PR objective of eliminating hardcoded binary paths at build time.
tests/virnetdevopenvswitchtest.c (4)
262-277: Replaced OVS_VSCTL macro with literal string "ovs-vsctl"This change removes the dependency on a hardcoded path macro and instead uses the command name directly, allowing the system to locate the binary through PATH at runtime. This aligns with the PR objective to stop hardcoding paths at build time.
286-292: Replaced OVS_VSCTL macro with literal string "ovs-vsctl"Consistent with the previous change, using the command name directly instead of a path macro.
298-304: Replaced OVS_VSCTL macro with literal string "ovs-vsctl"Consistent with previous changes, this removes hardcoded path dependencies.
319-325: Replaced OVS_VSCTL macro with literal string "ovs-vsctl"Final instance of replacing the OVS_VSCTL macro with a direct command name. This makes the test code consistent with the implementation code.
src/util/virnetdevip.c (5)
393-394: Platform-specific command name instead of IFCONFIG macroChanged from using the IFCONFIG macro to explicit string "ifconfig" for FreeBSD systems. This fits with the PR objective of relying on PATH for binary resolution instead of hardcoded paths.
407-407: Direct command name instead of IP macroUsing "ip" directly instead of a macro containing a hardcoded path, for non-FreeBSD systems.
434-435: Platform-specific command name instead of IFCONFIG macroConsistent with earlier change, using "ifconfig" directly for FreeBSD.
444-444: Direct command name instead of IP macroUsing "ip" directly for non-FreeBSD systems, consistent with other changes.
472-472: Direct command name instead of IP macroFinal instance of using "ip" directly instead of a macro with hardcoded path.
tests/virnetdevbandwidthtest.c (4)
148-161: Replaced TC and OVS_VSCTL macros with literal command stringsThe test commands now use "tc" and "ovs-vsctl" directly instead of macros containing hardcoded paths. This makes the test expectations consistent with the implementation code changes and supports the PR objective of eliminating hardcoded binary paths.
166-173: Replaced TC and OVS_VSCTL macros with literal command stringsConsistent with previous changes, the test now uses direct command names for command expectations.
179-196: Replaced TC and OVS_VSCTL macros with literal command stringsAnother instance of test commands using direct names instead of macro-based paths.
202-220: Replaced TC and OVS_VSCTL macros with literal command stringsFinal set of test command expectations updated to use direct command names.
src/storage/storage_backend_logical.c (1)
52-53: Runtime-resolvedvgchange– double-check PATH handlingReplacing the compile-time absolute path with the plain command name is in line with the PR goal and keeps the call site simple.
Please confirm that
virCommandwill fall back toexecvp()/virFindFileInPath()when the binary does not contain a/, so thatvgchangeis still located even when libvirtd sanitises$PATHfor non-interactive sessions.
If that is already the case, no further action is required.meson.build (3)
848-855: Optional dev-tools list clarifiedThe move to a simple literal list for optional tools (
augparse,black,flake8,pdwtags,pytest) reads clearer and avoids build-time path-hard-coding. Looks good.
865-865:missing_optional_programsbookkeeping extended – ok
1982-1986: NUMAD support now Linux-onlyGood tightening of the platform guard. Message is precise; no issues.
| 'black_path': black_path, | ||
| 'runutf8': ' '.join(runutf8), | ||
| 'PYTHON3': python3_prog.full_path(), | ||
| 'PERL': perl_prog.full_path(), |
There was a problem hiding this comment.
Undefined perl_prog variable
The line 'PERL': perl_prog.full_path(), references perl_prog which is not declared in this scope. This will cause a build error. Please add a find_program('perl', required: false) (or true if mandatory) assignment before using perl_prog.
Example fix:
# ...
awk_prog = find_program('awk')
+ perl_prog = find_program('perl', required: false)
syntax_check_conf = configuration_data({
'top_srcdir': meson.project_source_root(),
'top_builddir': meson.project_build_root(),
'flake8_path': flake8_path,
'black_path': black_path,
'runutf8': ' '.join(runutf8),
'PYTHON3': python3_prog.full_path(),
'PERL': perl_prog.full_path(),
'GREP': grep_prog.full_path(),
'SED': sed_prog.full_path(),
'AWK': awk_prog.full_path(),
})📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 'PERL': perl_prog.full_path(), | |
| awk_prog = find_program('awk') | |
| perl_prog = find_program('perl', required: false) | |
| syntax_check_conf = configuration_data({ | |
| 'top_srcdir': meson.project_source_root(), | |
| 'top_builddir': meson.project_build_root(), | |
| 'flake8_path': flake8_path, | |
| 'black_path': black_path, | |
| 'runutf8': ' '.join(runutf8), | |
| 'PYTHON3': python3_prog.full_path(), | |
| 'PERL': perl_prog.full_path(), | |
| 'GREP': grep_prog.full_path(), | |
| 'SED': sed_prog.full_path(), | |
| 'AWK': awk_prog.full_path(), | |
| }) |
Variable 'master' needs to be free because it will be reassigned in
virNetDevOpenvswitchInterfaceGetMaster().
The leaked stack:
Direct leak of 11 byte(s) in 1 object(s) allocated from:
#0 0x7f7dad8ba6df in __interceptor_malloc (/lib64/libasan.so.8+0xba6df)
#1 0x7f7dad715728 in g_malloc (/lib64/libglib-2.0.so.0+0x60728)
#2 0x7f7dad72d8b2 in g_strdup (/lib64/libglib-2.0.so.0+0x788b2)
#3 0x7f7dacb63088 in g_strdup_inline /usr/include/glib-2.0/glib/gstrfuncs.h:321
#4 0x7f7dacb63088 in virNetDevGetName ../src/util/virnetdev.c:823
#5 0x7f7dacb63886 in virNetDevGetMaster ../src/util/virnetdev.c:909
#6 0x7f7dacb90288 in virNetDevTapReattachBridge ../src/util/virnetdevtap.c:527
#7 0x7f7dacd5cd67 in virDomainNetNotifyActualDevice ../src/conf/domain_conf.c:30505
#8 0x7f7da3a10bc3 in qemuProcessNotifyNets ../src/qemu/qemu_process.c:3290
#9 0x7f7da3a375c6 in qemuProcessReconnect ../src/qemu/qemu_process.c:9211
#10 0x7f7dacc0cc53 in virThreadHelper ../src/util/virthread.c:256
#11 0x7f7dac2875d4 in start_thread (/lib64/libc.so.6+0x875d4)
#12 0x7f7dac3091bb in __GI___clone3 (/lib64/libc.so.6+0x1091bb)
Fixes: de938b9
Signed-off-by: QiangWei Zhang <[email protected]>
Reviewed-by: Peter Krempa <[email protected]>
Over the years we've made various changes to stop hardcoding paths at
build time, but the work is incomplete.
This bit us significantly in Fedora 42 where they have merged the 'sbin'
and 'bin' dirs together. In the build environment we have a clean
install where '/sbin' and '/usr/sbin' are simply symlinks to '/usr/bin'.
Our meson.build logic preferentially looks in '/sbin' and '/usr/sbin'
to find programs, and thus it finds all binaries in '/sbin' and then
hardcodes this path. This happens even for binaries that have always
been in '/usr/bin' and NEVER '/sbin' or '/usr/sbin'
On fresh Fedora installs this is fine as the symlinks match the build
environment.
On upgraded Fedora installs, however, '/sbin' and '/usr/sbin' remain
separate directories and inside they symlink individual binaries,
if-and-only-if the binary was in '/sbin' in Fedora 41.
Thus many of the binaries we found in /sbin don't actually exist and
libvirt thus breaks.
There is really no reason why we should be harcoding any paths at
build time. virCommand happily uses virFindFileInPath for any paths
which are not already absolute. $PATH includes '/sbin' and '/usr/sbin'
when we're running privileged, and when unprivileged we shouldn't need
to run binaries from there.
Summary by Sourcery
Remove hardcoded paths for system binaries in the libvirt build system, improving portability and compatibility across different Linux distributions
Enhancements:
Chores:
Summary by CodeRabbit
tcutility in recognized firewall tools.