Skip to contentSkip to conversation

Polish module_directory help string, install symlinks

PATCH In review Emil Velikov 3 participants 15 messages Jan 26, 2024 – Feb 20, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Polish module_directory help string, install symlinks

Hello all,

I've noticed the recent module_directory work and I'm super hyped to see it released. Are there any plans for v32?

This tiny series has two patches:
- tweaks the help string for the module_directory toggle
- installs the insmod, rmmod, lsmod ... symlinks

The above should be fairly straightforward, but if there's any questions or concerns do let me know.

Thanks
Emil

---
Emil Velikov (2):
configure: tweak the module_directory help string
make: install/uninstall tools symlinks to kmod

 Makefile.am  | 10 ++++++++++
 configure.ac |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

---
base-commit: 48b0c75f79f86140314b9656d3d855a515e18a73
change-id: 20240126-master-5ba286b26eed

Best regards,

Signature · 1 line
Emil Velikov <[email protected]>
#1 lore raw

PATCH 1/2 configure: tweak the module_directory help string

From: Emil Velikov <[email protected]>

Drop the somewhat misleading ${prefix}/lib/modules and explicitly mention what's the default.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index de01e08..ab0b303 100644
@@ -93,7 +93,7 @@ AC_SUBST([rootlibdir], [$with_rootlibdir])
 
 # Ideally this would be $prefix/lib/modules but default to /lib/modules for compatibility with earlier versions
 AC_ARG_WITH([module_directory],
-        AS_HELP_STRING([--with-module-directory=DIR], [directory in which to look for kernel modules - typically '/lib/modules' or '${prefix}/lib/modules']),
+        AS_HELP_STRING([--with-module-directory=DIR], [directory in which to look for kernel modules @<:@default=/lib/modules@:>@]),
         [], [with_module_directory=/lib/modules])
 AC_SUBST([module_directory], [$with_module_directory])
 
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/2 make: install/uninstall tools symlinks to kmod

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Currently we create symlinks like modprobe (pointing to kmod), during the normal make build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at make install time. Thus one can actually use those without additional changes. As an added bonus, distributions can drop the similar hunk from their packaging.

---
Out of curiosity: are there any plans about releasing v32? I'm interested in the recent /usr/lib/modules (module_directory) patches.

Thanks o/

---
 Makefile.am | 10 ++++++++++
 1 file changed, 10 insertions(+)
Makefile.am +10 -0
index 4062d81..a22d1b1 100644
@@ -111,9 +111,19 @@ install-exec-hook:
 		ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
 		mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
 	fi
+if BUILD_TOOLS
+	for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
+		$(LN_S) $(bindir)/kmod $(DESTDIR)$(bindir)/$$tool; \
+	done
+endif
 
 uninstall-hook:
 	rm -f $(DESTDIR)$(rootlibdir)/libkmod.so*
+if BUILD_TOOLS
+	for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
+		rm -f $(DESTDIR)$(bindir)/$$tool; \
+	done
+endif
 
 if BUILD_TOOLS
 bin_PROGRAMS = tools/kmod
Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 9 lines · On Fri, Jan 26, 2024 at 02:43:51PM +0000, Emil Velikov via B4 Relay wrote:

From: Emil Velikov <[email protected]>

Currently we create symlinks like modprobe (pointing to kmod), during the normal make build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at make install time. Thus one can actually use those without additional changes. As an added bonus, distributions can drop the similar hunk from their packaging.

It was a long time ago and my memory may be fading, but afair the fact that distros were doing it was what prevented us from adding the symlinks ourselves.... and then we never re-visited this.

I'll dig some history before applying to make sure I'm not forgetting something.

Quoted 5 lines

---
Out of curiosity: are there any plans about releasing v32? I'm interested in the recent /usr/lib/modules (module_directory) patches.

yes, I should be releasing that soon, probably this week or the next.

thanks
Lucas De Marchi

#4 lore raw

Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 12 lines · Lucas De Marchi
Quoted 9 lines · On Fri, Jan 26, 2024 at 02:43:51PM +0000, Emil Velikov via B4 Relay wrote:

From: Emil Velikov <[email protected]>

Currently we create symlinks like modprobe (pointing to kmod), during the normal make build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at make install time. Thus one can actually use those without additional changes. As an added bonus, distributions can drop the similar hunk from their packaging.

Quoted 7 lines

It was a long time ago and my memory may be fading, but afair the fact that distros were doing it was what prevented us from adding the symlinks ourselves.... and then we never re-visited this.

I'll dig some history before applying to make sure I'm not forgetting something.

Ack, makes sense. Fwiw I've already opened a MR with the Arch team highlighting these changes.

Sadly I don't have contact for other maintainers.

Quoted 9 lines
Quoted 5 lines

---
Out of curiosity: are there any plans about releasing v32? I'm interested in the recent /usr/lib/modules (module_directory) patches.

yes, I should be releasing that soon, probably this week or the next.

Thanks much appreciated.
Emil

#5 lore raw

Re: Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 17 lines · Emil Velikov
Quoted 16 lines · Lucas De Marchi
Quoted 9 lines · On Fri, Jan 26, 2024 at 02:43:51PM +0000, Emil Velikov via B4 Relay wrote:

From: Emil Velikov <[email protected]>

Currently we create symlinks like modprobe (pointing to kmod), during the normal make build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at make install time. Thus one can actually use those without additional changes. As an added bonus, distributions can drop the similar hunk from their packaging.

It was a long time ago and my memory may be fading, but afair the fact that distros were doing it was what prevented us from adding the symlinks ourselves.... and then we never re-visited this.

Quoted 5 lines
Quoted 3 lines

I'll dig some history before applying to make sure I'm not forgetting something.

Ack, makes sense. Fwiw I've already opened a MR with the Arch team highlighting these changes.

no wonder my memory faded as it was almost 12 years ago and during kmod 3 ~ 5.

00fc926 build-sys: create symlinks instead of building separate tools

when we started using symlinks to a single kmod binary

7bbf523 build-sys: create symlinks if we are installing tools 12fd9cd build-sys: forcefully create links

when we started creating the symlinks

fe8b067 build-sys: do not create symlinks by default

stop creating the symlinks since it was not working across distros and creating more problems than solving

Now that distros configure all the paths through configure options, we can probably re-attempt this.

Cc'ing some pkg maintainers

Lucas De Marchi

Quoted 15 lines

Sadly I don't have contact for other maintainers.

Quoted 9 lines
Quoted 5 lines

---
Out of curiosity: are there any plans about releasing v32? I'm interested in the recent /usr/lib/modules (module_directory) patches.

yes, I should be releasing that soon, probably this week or the next.

Thanks much appreciated.
Emil

#6 lore raw

Re: Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 39 lines · Lucas De Marchi
Quoted 17 lines · Emil Velikov
Quoted 16 lines · Lucas De Marchi
Quoted 9 lines · On Fri, Jan 26, 2024 at 02:43:51PM +0000, Emil Velikov via B4 Relay wrote:

From: Emil Velikov <[email protected]>

Currently we create symlinks like modprobe (pointing to kmod), during the normal make build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at make install time. Thus one can actually use those without additional changes. As an added bonus, distributions can drop the similar hunk from their packaging.

It was a long time ago and my memory may be fading, but afair the fact that distros were doing it was what prevented us from adding the symlinks ourselves.... and then we never re-visited this.

Quoted 5 lines
Quoted 3 lines

I'll dig some history before applying to make sure I'm not forgetting something.

Ack, makes sense. Fwiw I've already opened a MR with the Arch team highlighting these changes.

no wonder my memory faded as it was almost 12 years ago and during kmod 3 ~ 5.

00fc926 build-sys: create symlinks instead of building separate tools

when we started using symlinks to a single kmod binary

7bbf523 build-sys: create symlinks if we are installing tools 12fd9cd build-sys: forcefully create links

when we started creating the symlinks

fe8b067 build-sys: do not create symlinks by default

Quoted 8 lines

stop creating the symlinks since it was not working across distros and creating more problems than solving

Now that distros configure all the paths through configure options, we can probably re-attempt this.

Cc'ing some pkg maintainers

Thanks for the information. Curiosity got the best of me, so I had a look across few distros:

Arch - installs kmod in /usr/bin, symlinks are in /usr/bin.

Debian - installs kmod in /usr/bin and symlinks are split across /usr/bin and /usr/sbin. Cannot find any references if they're aiming to merge /usr/bin and /usr/sbin.

Fedora - installs kmod in /usr/bin and symlinks are split across /usr/bin and /usr/sbin. Fedora 40 is aiming to "merge" /usr/bin and /usr/sbin.

Gentoo - installs kmod in /bin and symlinks are split across /bin and /sbin. Gentoo has merged /usr (/{,s}bin being a symlink to /usr/{.s}bin) and merged bin (/usr/sbin is a symlink to /usr/bin in some instances.
The https://wiki.gentoo.org/wiki/Merge-usr wiki explains the tool aiming with merge conversions, although it seems to be optional albeit highly(?) recommended.

TlDr: Distro variations still exist. Arch is fine, Fedora 40 should be OK. Debian will need an in-package tweak. Gentoo will be fine for most or at least some instances.

Personally (Arch user here) it makes sense to land and release this, alongside the /usr/lib/modules support. Although if you think it makes sense to defer for a later date, that's fine with me.

Regards,
Emil

#7 lore raw

Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 3 lines · Emil Velikov

Debian - installs kmod in /usr/bin and symlinks are split across /usr/bin and /usr/sbin. Cannot find any references if they're aiming to merge /usr/bin and /usr/sbin.

There are no such plans at this point.
I definitely will not be pushing for that, but somebody else might.

Signature · 2 lines
ciao,
Marco
#8 lore raw

Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

In reply to Emil Velikov
Quoted 25 lines · On Fri, Jan 26, 2024 at 02:43:51PM +0000, Emil Velikov via B4 Relay wrote:

From: Emil Velikov <[email protected]>

Currently we create symlinks like modprobe (pointing to kmod), during the normal make build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at make install time. Thus one can actually use those without additional changes. As an added bonus, distributions can drop the similar hunk from their packaging.

---
Out of curiosity: are there any plans about releasing v32? I'm interested in the recent /usr/lib/modules (module_directory) patches.

Thanks o/
---
Makefile.am | 10 ++++++++++

1 file changed, 10 insertions(+)
Makefile.am +0 -0
index 4062d81..a22d1b1 100644

Makefile.am install-exec-hook: · line 116

Quoted 6 lines
Makefile.am +3 -0
@@ -111,9 +111,19 @@ install-exec-hook:
 		ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
 		mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
 	fi
+if BUILD_TOOLS
+	for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
+		$(LN_S) $(bindir)/kmod $(DESTDIR)$(bindir)/$$tool; \

I was about to apply this, but then noticed a problem: I think we should use a relative symlink here.

$ DESTDIR=/tmp/inst make install
$ ls -l /tmp/inst/usr/bin
total 700
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 depmod -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 insmod -> /usr/bin/kmod
-rwxr-xr-x 1 ldmartin ldmartin 715432 Feb  2 12:44 kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 lsmod -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 modinfo -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 modprobe -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 rmmod -> /usr/bin/kmod

should had been e.g. depmod -> ./kmod

Simplest fix without resorting to calculating the shortest symlink is to
assume: the symlinks should be in the same dir as kmod, just like if they were not symlinks.

Makefile.am +1 -1
index 39a46f4..6df2f60 100644
@@ -113,7 +113,7 @@ install-exec-hook:
        fi
 if BUILD_TOOLS
        for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
-               $(LN_S) $(bindir)/kmod $(DESTDIR)$(bindir)/$$tool; \
+               $(LN_S) ./kmod $(DESTDIR)$(bindir)/$$tool; \
        done
 endif
 

does that seem ok squashed on your patch?

thanks
Lucas De Marchi

#9 lore raw

Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Hey Lucas,

Quoted 48 lines · Lucas De Marchi
Quoted 25 lines · On Fri, Jan 26, 2024 at 02:43:51PM +0000, Emil Velikov via B4 Relay wrote:

From: Emil Velikov <[email protected]>

Currently we create symlinks like modprobe (pointing to kmod), during the normal make build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at make install time. Thus one can actually use those without additional changes. As an added bonus, distributions can drop the similar hunk from their packaging.

---
Out of curiosity: are there any plans about releasing v32? I'm interested in the recent /usr/lib/modules (module_directory) patches.

Thanks o/
---
Makefile.am | 10 ++++++++++

1 file changed, 10 insertions(+)
Makefile.am +0 -0
index 4062d81..a22d1b1 100644

Makefile.am install-exec-hook: · line 116

Quoted 6 lines
Makefile.am +3 -0
@@ -111,9 +111,19 @@ install-exec-hook:
              ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
              mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
      fi
+if BUILD_TOOLS
+      for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
+              $(LN_S) $(bindir)/kmod $(DESTDIR)$(bindir)/$$tool; \

I was about to apply this, but then noticed a problem: I think we should use a relative symlink here.

$ DESTDIR=/tmp/inst make install
$ ls -l /tmp/inst/usr/bin
total 700
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 depmod -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 insmod -> /usr/bin/kmod
-rwxr-xr-x 1 ldmartin ldmartin 715432 Feb  2 12:44 kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 lsmod -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 modinfo -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 modprobe -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 rmmod -> /usr/bin/kmod
Quoted 6 lines

should had been e.g. depmod -> ./kmod

Simplest fix without resorting to calculating the shortest symlink is to
assume: the symlinks should be in the same dir as kmod, just like if they were not symlinks.

I'm not sure I follow, can you elaborate what is the issue?

Are you trying to use/run files installed in DESTDIR directly? If so, that won't work for a few reasons:
- kmod does not link to the in-DESTDIR libkmod.so, admittedly one can
workaround it with LD_PRELOAD/LD_LIBRARY_PATH
- kmod tries to open the depmod config files in the normal
non-DESTDIR locations

Quoted 13 lines
Makefile.am +1 -1
index 39a46f4..6df2f60 100644
@@ -113,7 +113,7 @@ install-exec-hook:
         fi
  if BUILD_TOOLS
         for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
-               $(LN_S) $(bindir)/kmod $(DESTDIR)$(bindir)/$$tool; \
+               $(LN_S) ./kmod $(DESTDIR)$(bindir)/$$tool; \
         done
  endif
 
Quoted 2 lines

does that seem ok squashed on your patch?

I'm not a huge fan of using relative symlinks, especially if the tool is run as root. In my experience that makes things harder to audit and prevent accidental breakages.

As an example, my Arch box has the following:

- /usr/bin/init -> ../lib/systemd/systemd
- /usr/bin/ld.so -> ../lib/ld-linux-x86-64.so.2
Hmm should probably see if we can change these and how many things will break

- /usr/bin/lirc-setup -> ../lib/python3.11/site-packages/lirc-setup/lirc-setup
Modern practises are to have a shim in /usr/bin/

- /usr/bin/slapacl -> ../lib/slapd
- /usr/bin/slapadd -> ../lib/slapd
- moar slapd
Hmm what is openldap doing on this system again

In other words - I'd love it if we don't use relative symlinks if there are other options.

Thanks,
Emil

#10 lore raw

Re: Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 58 lines · Emil Velikov

Hey Lucas,

Quoted 48 lines · Lucas De Marchi
Quoted 25 lines · On Fri, Jan 26, 2024 at 02:43:51PM +0000, Emil Velikov via B4 Relay wrote:

From: Emil Velikov <[email protected]>

Currently we create symlinks like modprobe (pointing to kmod), during the normal make build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at make install time. Thus one can actually use those without additional changes. As an added bonus, distributions can drop the similar hunk from their packaging.

---
Out of curiosity: are there any plans about releasing v32? I'm interested in the recent /usr/lib/modules (module_directory) patches.

Thanks o/
---
Makefile.am | 10 ++++++++++

1 file changed, 10 insertions(+)
Makefile.am +0 -0
index 4062d81..a22d1b1 100644

Makefile.am install-exec-hook: · line 116

Quoted 6 lines
Makefile.am +3 -0
@@ -111,9 +111,19 @@ install-exec-hook:
              ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
              mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
      fi
+if BUILD_TOOLS
+      for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
+              $(LN_S) $(bindir)/kmod $(DESTDIR)$(bindir)/$$tool; \

I was about to apply this, but then noticed a problem: I think we should use a relative symlink here.

$ DESTDIR=/tmp/inst make install
$ ls -l /tmp/inst/usr/bin
total 700
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 depmod -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 insmod -> /usr/bin/kmod
-rwxr-xr-x 1 ldmartin ldmartin 715432 Feb  2 12:44 kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 lsmod -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 modinfo -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 modprobe -> /usr/bin/kmod
lrwxrwxrwx 1 ldmartin ldmartin     13 Feb  2 12:44 rmmod -> /usr/bin/kmod
Quoted 6 lines

should had been e.g. depmod -> ./kmod

Simplest fix without resorting to calculating the shortest symlink is to
assume: the symlinks should be in the same dir as kmod, just like if they were not symlinks.

Quoted 4 lines

I'm not sure I follow, can you elaborate what is the issue?

Are you trying to use/run files installed in DESTDIR directly? If so, that won't work for a few reasons:

no, those would usually be done by setting prefix and sysconfdir

Quoted 18 lines

- kmod does not link to the in-DESTDIR libkmod.so, admittedly one can workaround it with LD_PRELOAD/LD_LIBRARY_PATH
- kmod tries to open the depmod config files in the normal non-DESTDIR locations

Quoted 13 lines
Makefile.am +1 -1
index 39a46f4..6df2f60 100644
@@ -113,7 +113,7 @@ install-exec-hook:
         fi
  if BUILD_TOOLS
         for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
-               $(LN_S) $(bindir)/kmod $(DESTDIR)$(bindir)/$$tool; \
+               $(LN_S) ./kmod $(DESTDIR)$(bindir)/$$tool; \
         done
  endif
 
Quoted 6 lines
Quoted 2 lines

does that seem ok squashed on your patch?

I'm not a huge fan of using relative symlinks, especially if the tool is run as root. In my experience that makes things harder to audit and prevent accidental breakages.

I'm completely in the opposite camp. Relative symlinks actually make sure the thing you are running is what you are expecting. Nothing should really point outside of $prefix expecting that is mounted on /.

Several years back there was also the issue with packaging, which would complain when symlinks pointed outside what was being packaged. It is dangerous when using absolute symlinks because if the tool used to copy follows the symlinks, it ends up with the wrong binary, copying the host bin rather than what was just built.

Lucas De Marchi

Quoted 21 lines

As an example, my Arch box has the following:

- /usr/bin/init -> ../lib/systemd/systemd
- /usr/bin/ld.so -> ../lib/ld-linux-x86-64.so.2
Hmm should probably see if we can change these and how many things will break

- /usr/bin/lirc-setup -> ../lib/python3.11/site-packages/lirc-setup/lirc-setup Modern practises are to have a shim in /usr/bin/

- /usr/bin/slapacl -> ../lib/slapd
- /usr/bin/slapadd -> ../lib/slapd
- moar slapd
Hmm what is openldap doing on this system again

In other words - I'd love it if we don't use relative symlinks if there are other options.

Thanks,
Emil

#11 lore raw

Re: Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

On Mon, 5 Feb 2024 at 14:30, Lucas De Marchi <[email protected]> wrote:

[snip]

Quoted 7 lines
Quoted 2 lines

I'm not a huge fan of using relative symlinks, especially if the tool> >is run as root. In my experience that makes things harder to audit and prevent accidental breakages.

I'm completely in the opposite camp. Relative symlinks actually make sure the thing you are running is what you are expecting. Nothing should really point outside of $prefix expecting that is mounted on /.

That is true and I fully agree. Yet the contents of DESTDIR are not meant to be run as-is - it's used for "staging" [1].

[1] https://www.gnu.org/software/make/manual/html_node/DESTDIR.html

Quoted 6 lines

Several years back there was also the issue with packaging, which would complain when symlinks pointed outside what was being packaged. It is dangerous when using absolute symlinks because if the tool used to copy follows the symlinks, it ends up with the wrong binary, copying the host bin rather than what was just built.

That sounds like a horrible bug, which can easily break your system regardless of the project.

Would you consider dropping the leading ./ aka can we use $(LN_S) kmod $(DESTDIR)$(bindir)/$$tool;?
Seems to be prevailing on my system with over 90% instances.

Thanks,
Emil

#12 lore raw

Re: Re: Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 24 lines · Emil Velikov

On Mon, 5 Feb 2024 at 14:30, Lucas De Marchi <[email protected]> wrote:

[snip]

Quoted 7 lines
Quoted 2 lines

I'm not a huge fan of using relative symlinks, especially if the tool> >is run as root. In my experience that makes things harder to audit and prevent accidental breakages.

I'm completely in the opposite camp. Relative symlinks actually make sure the thing you are running is what you are expecting. Nothing should really point outside of $prefix expecting that is mounted on /.

That is true and I fully agree. Yet the contents of DESTDIR are not meant to be run as-is - it's used for "staging" [1].

[1] https://www.gnu.org/software/make/manual/html_node/DESTDIR.html

Quoted 6 lines

Several years back there was also the issue with packaging, which would complain when symlinks pointed outside what was being packaged. It is dangerous when using absolute symlinks because if the tool used to copy follows the symlinks, it ends up with the wrong binary, copying the host bin rather than what was just built.

Quoted 6 lines

That sounds like a horrible bug, which can easily break your system regardless of the project.

Would you consider dropping the leading ./ aka can we use $(LN_S) kmod $(DESTDIR)$(bindir)/$$tool;?
Seems to be prevailing on my system with over 90% instances.

seems good to me. I will squash that and push.

thanks
Lucas De Marchi

Quoted 3 lines

Thanks,
Emil

#13 lore raw

Re: Re: Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 26 lines · Lucas De Marchi
Quoted 24 lines · Emil Velikov

On Mon, 5 Feb 2024 at 14:30, Lucas De Marchi <[email protected]> wrote:

[snip]

Quoted 7 lines
Quoted 2 lines

I'm not a huge fan of using relative symlinks, especially if the tool> >is run as root. In my experience that makes things harder to audit and prevent accidental breakages.

I'm completely in the opposite camp. Relative symlinks actually make sure the thing you are running is what you are expecting. Nothing should really point outside of $prefix expecting that is mounted on /.

That is true and I fully agree. Yet the contents of DESTDIR are not meant to be run as-is - it's used for "staging" [1].

[1] https://www.gnu.org/software/make/manual/html_node/DESTDIR.html

Quoted 6 lines

Several years back there was also the issue with packaging, which would complain when symlinks pointed outside what was being packaged. It is dangerous when using absolute symlinks because if the tool used to copy follows the symlinks, it ends up with the wrong binary, copying the host bin rather than what was just built.

Quoted 9 lines
Quoted 6 lines

That sounds like a horrible bug, which can easily break your system regardless of the project.

Would you consider dropping the leading ./ aka can we use $(LN_S) kmod $(DESTDIR)$(bindir)/$$tool;?
Seems to be prevailing on my system with over 90% instances.

seems good to me. I will squash that and push.

Respectful poke?

Thanks
Emil

#14 lore raw

Re: Re: Re: Re: [PATCH 2/2] make: install/uninstall tools symlinks to kmod

Quoted 27 lines · Emil Velikov
Quoted 26 lines · Lucas De Marchi
Quoted 24 lines · Emil Velikov

On Mon, 5 Feb 2024 at 14:30, Lucas De Marchi <[email protected]> wrote:

[snip]

Quoted 7 lines
Quoted 2 lines

I'm not a huge fan of using relative symlinks, especially if the tool> >is run as root. In my experience that makes things harder to audit and prevent accidental breakages.

I'm completely in the opposite camp. Relative symlinks actually make sure the thing you are running is what you are expecting. Nothing should really point outside of $prefix expecting that is mounted on /.

That is true and I fully agree. Yet the contents of DESTDIR are not meant to be run as-is - it's used for "staging" [1].

[1] https://www.gnu.org/software/make/manual/html_node/DESTDIR.html

Quoted 6 lines

Several years back there was also the issue with packaging, which would complain when symlinks pointed outside what was being packaged. It is dangerous when using absolute symlinks because if the tool used to copy follows the symlinks, it ends up with the wrong binary, copying the host bin rather than what was just built.

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

That sounds like a horrible bug, which can easily break your system regardless of the project.

Would you consider dropping the leading ./ aka can we use $(LN_S) kmod $(DESTDIR)$(bindir)/$$tool;?
Seems to be prevailing on my system with over 90% instances.

seems good to me. I will squash that and push.

sorry I went on vacations and didn't realize I hadn't pushed. Now it's in and with the other patches fixing make distcheck we are clear for a release. I will prep that this week.

thanks
Lucas De Marchi

Quoted 6 lines
Quoted 1 line

Respectful poke?

Thanks
Emil