Public bug reported:

<man:getopt(1)>
> -l, --longoptions longopts
> … More than one option name may be specified at once, by separating the names 
> with commas. …

util-linux-2.39.3/misc-utils/getopt.c
291 /*
292  * Register several long options. options is a string of long options,
293  * separated by commas or whitespace. This nukes options!
294  */
295 static void add_long_options(struct getopt_control *ctl, char *options)
296 {
297 »·······int arg_opt;
298 »·······char *tokptr = strtok(options, ", \t\n");

That's a great feature, which should be documented accordingly in the
manual page.

Not yet fixed upstream:
- https://www.kernel.org/pub/linux/utils/util-linux/
- https://github.com/util-linux/util-linux/blob/master/misc-utils/getopt.1.adoc
- https://github.com/util-linux/util-linux/issues/4119

No matching Debian bug: https://bugs.debian.org/cgi-
bin/pkgreport.cgi?repeatmerged=yes&src=util-linux

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: util-linux 2.39.3-9ubuntu6.5
ProcVersionSignature: Ubuntu 6.8.0-101.101-generic 6.8.12
Uname: Linux 6.8.0-101-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.28.1-0ubuntu3.8
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Fri Mar 13 19:42:32 2026
InstallationDate: Installed on 2025-01-31 (406 days ago)
InstallationMedia: Ubuntu 22.04.5 LTS "Jammy Jellyfish" - Release amd64 
(20240911)
SourcePackage: util-linux
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: util-linux (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug noble

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2144357

Title:
  getopt --long also accepts whitespace separated list

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/2144357/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to