Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 534602 - sys-apps/lsb-release-1.4 - lsb_release calls getopt with invalid option --long
Summary: sys-apps/lsb-release-1.4 - lsb_release calls getopt with invalid option --long
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jeroen Roovers (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-04 11:53 UTC by Merlijn Wajer
Modified: 2015-01-04 22:57 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Merlijn Wajer 2015-01-04 11:53:19 UTC
File lsb_release in package sys-apps/lsb-release uses the wrong flag for 'long' options. It uses --long which seems invalid. Either -l or --longoptions are valid.

The inproper usage of getopt in this case causes a failure to merge lsb-release.

My system is musl gentoo hardened, on ARM. The issue is partially explained here: http://www.openwall.com/lists/musl/2014/07/26/10

Either way, I see no harm in changing --long to --longoptions for better compatibility and being more compliant.

The same problem occurs with lsb-release-1.4-r1 and 1.4-r2.

Reproducible: Always

Steps to Reproduce:
1. emerge sys-apps/lsb-release
2. 
3.
Actual Results:  
Build fails due to improper getopt usage

Expected Results:  
Build should not fail

The getopt call is done in the file lsb_release, in the function EnhancedGetopt around line 124. The actual call is done on line 128.
Comment 1 Merlijn Wajer 2015-01-04 11:56:47 UTC
The alternative is waiting for musl people to change this behaviour in musl itself (if they are going to change it). I'm fine with either and fixed this locally for myself by changing the option. It seemed sensible to file a bug regardless.

Feel free to close if this is not deemed sensible.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2015-01-04 21:34:58 UTC
Note: the one installed by sys-apps/util-linux seems fine with this:

# /usr/bin/getopt --long
/usr/bin/getopt: option '--longoptions' requires an argument

Fixed in -r3.
Comment 3 Merlijn Wajer 2015-01-04 22:57:29 UTC
Thank you for fixing this. FWIW: The one from util-linux is the same one I use; it's just that the flag --long only works when linked with glibc. But now it also works when linked with musl. Thank you!

(For completeness sake, I think that the musl developers are now also implementing this non-standard functionality)