[Bug 1225197] New: util-linux depends on libmagic

https://bugzilla.suse.com/show_bug.cgi?id=1225197 Bug ID: 1225197 Summary: util-linux depends on libmagic Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem Assignee: sbrabec@suse.com Reporter: fvogt@suse.com QA Contact: qa-bugs@suse.de CC: bci-internal@suse.de Target Milestone: --- Found By: --- Blocker: --- util-linux has a hard dependency on libmagic1 and thus file-magic, which is rather big (~9MiB). It's only pulled in because /usr/bin/more links against it. Can this dependency be avoided for instance by removing libmagic support from more? That's what Debian, Fedora and Ubuntu do as well. -- You are receiving this mail because: You are on the CC list for the bug.

https://bugzilla.suse.com/show_bug.cgi?id=1225197 Thorsten Kukuk <kukuk@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kukuk@suse.com -- You are receiving this mail because: You are on the CC list for the bug.

https://bugzilla.suse.com/show_bug.cgi?id=1225197 https://bugzilla.suse.com/show_bug.cgi?id=1225197#c1 Stanislav Brabec <sbrabec@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |CONFIRMED --- Comment #1 from Stanislav Brabec <sbrabec@suse.com> --- Is it a problem of Ring 0 bootstrap build loop size or a problem of a cut down image size? more uses libmagic to identify binary files. In the first case, move of more from util-linux to util-linux systemd could help. In the second case, I would suggest to create a new sub-package containing feature stripped binaries: more without libmagic support findmnt, lsblk without libudev logger, lslogins, uuidd without libsystemd It could help to create minimal images for the non bootable containers. -- You are receiving this mail because: You are on the CC list for the bug.

https://bugzilla.suse.com/show_bug.cgi?id=1225197 https://bugzilla.suse.com/show_bug.cgi?id=1225197#c2 --- Comment #2 from Thorsten Kukuk <kukuk@suse.com> --- (In reply to Stanislav Brabec from comment #1)
Is it a problem of Ring 0 bootstrap build loop size or a problem of a cut down image size?
Size is a problem, especially on low level hard required tools.
more uses libmagic to identify binary files.
Yes, but as Fabian wrote: no other big distribution compiles more with this dependency, and people normally use less since >> 25 years. more is only the last fallback if less is not there, e.g. in containers.
In the second case, I would suggest to create a new sub-package containing feature stripped binaries: more without libmagic support findmnt, lsblk without libudev logger, lslogins, uuidd without libsystemd
It could help to create minimal images for the non bootable containers.
It's not only about containers, it's also about the default install size of our system. We have some projects with partners, were size is all what matters for various reasons. E.g. limited size in ROM. So your sub-package solution will not help here, as we need the other tools with that dependencies. And currently it's really just about more. -- You are receiving this mail because: You are on the CC list for the bug.

https://bugzilla.suse.com/show_bug.cgi?id=1225197 https://bugzilla.suse.com/show_bug.cgi?id=1225197#c3 --- Comment #3 from Dirk Mueller <dmueller@suse.com> --- it doesn't actually use the magic "features" for anything other than refusing to show a file if it is considered binary. here's the code in question: /* check_magic -- check for file magic numbers. */ static int check_magic(struct more_control *ctl, char *fs) { #ifdef HAVE_MAGIC ⇥ const int fd = fileno(ctl->current_file); ⇥ const char *mime_encoding = magic_descriptor(ctl->magic, fd); ⇥ const char *magic_error_msg = magic_error(ctl->magic); ⇥ if (magic_error_msg) { ⇥ ⇥ printf("%s: %s: %s\n", program_invocation_short_name, ⇥ ⇥ ⇥ _("magic failed"), magic_error_msg); ⇥ ⇥ return 0; ⇥ } ⇥ if (!mime_encoding || !(strcmp("binary", mime_encoding))) { ⇥ ⇥ printf(_("\n******** %s: Not a text file ********\n\n"), fs); ⇥ ⇥ return 1; ⇥ } #else ⇥ signed char twobytes[2]; ⇥ /* don't try to look ahead if the input is unseekable */ ⇥ if (fseek(ctl->current_file, 0L, SEEK_SET)) ⇥ ⇥ return 0; ⇥ if (fread(twobytes, 2, 1, ctl->current_file) == 1) { ⇥ ⇥ switch (twobytes[0] + (twobytes[1] << 8)) { ⇥ ⇥ case 0407:⇥ /* a.out obj */ ⇥ ⇥ case 0410:⇥ /* a.out exec */ ⇥ ⇥ case 0413:⇥ /* a.out demand exec */ ⇥ ⇥ case 0405: ⇥ ⇥ case 0411: ⇥ ⇥ case 0177545: ⇥ ⇥ case 0x457f:⇥ /* simple ELF detection */ ⇥ ⇥ ⇥ printf(_("\n******** %s: Not a text file ********\n\n"), ⇥ ⇥ ⇥ fs); ⇥ ⇥ ⇥ return 1; ⇥ ⇥ } ⇥ } ⇥ fseek(ctl->current_file, 0L, SEEK_SET);⇥/* rewind() not necessary */ #endif ⇥ return 0; so it does implement the same feature without it, just maybe in a less correct way. but it could easily be extended should there be a regression report coming in. -- You are receiving this mail because: You are on the CC list for the bug.

https://bugzilla.suse.com/show_bug.cgi?id=1225197 https://bugzilla.suse.com/show_bug.cgi?id=1225197#c4 --- Comment #4 from Dirk Mueller <dmueller@suse.com> --- https://build.opensuse.org/request/show/1179681 -- You are receiving this mail because: You are on the CC list for the bug.

https://bugzilla.suse.com/show_bug.cgi?id=1225197 https://bugzilla.suse.com/show_bug.cgi?id=1225197#c6 Stanislav Brabec <sbrabec@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #6 from Stanislav Brabec <sbrabec@suse.com> --- OK, makes sense. You submit is on the way fo Factory. The subpackage could make sense as well, especially if there will be a need for a util-linux-systemd variant that does not depend on libsystemd.so.0. (We do not want such binaries on a regular system, but for containers that don't contain systemd it could be OK.) -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com