Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 02 Oct 2014 16:14:52 -0400
From: "Anthony G. Basile" <basile@...nsource.dyc.edu>
To: musl@...ts.openwall.com
Subject: Unusual behavior with bash subshell and getopt

Hi everyone,

Today I finally got around to debugging why xsltproc was failing in 
packages where man pages were being generated from xml.  It is because 
/etc/xml/{catalog,docbook} is not being generated by 
build-docbook-catalog.  The later is a bash script which behave 
differently in musl than it does in glibc.  I reduced the problem to the 
following:

#!/bin/bash

opts=$(getopt -o h --long help -- "$@") || exit 1
eval set -- "${opts}"
while true; do
	case $1 in
		-h|--help) echo "help" ;;
		--) break ;;
	esac
	shift
done
echo "$@"


When run in glibc this gives:

~ # ./test-getops.sh --help 1 2 3
help
-- 1 2 3


but when run under musl:

~ # ./test-getops.sh --help 1 2 3
Try `getopt --help' for more information.


Everything else about these systems is identical.  Any clues?

-- 
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.