[pacman-dev] Why not using the bash getopts buildin? Was: Removing deltas from repos

Marc - A. Dahlhaus mad at wol.de
Wed Sep 16 15:07:26 EDT 2009


Xavier schrieb:
> On Wed, Sep 16, 2009 at 6:39 PM, Aaron Griffin <aaronmgriffin at gmail.com> wrote:
>>>> Thanks for pointing that out.
>>>> I only did a quick look at the outputs of a recursive grep for getopt but
>>>> missed that it only found it in some comments...
>>> As makepkg shebangs for /bin/bash, why don't we use the getopts buildin
>>> of bash in the first place, was there a reason to not use it?
>>>
>>> To make usage of it could be a reduction in code size (will look into it
>>> if it's desired) and also would not be a portability issue IMO.
>> It's not portable
>>
>>
> 
> a bash builtin should be the most portable thing :)
> 
> We used getopts in the beginning, but it was changed to gnu getopt
> (probably because supporting both long and short options is much
> easier), and then we had to move to our own implementation for
> portability problem.
> 
> This should give you all the information about the history :
> http://projects.archlinux.org/?p=pacman.git&a=search&h=HEAD&st=commit&s=getopt
> 
> When the portability problem was raised, I remember a long discussion
> about the different alternatives. Like moving back to getopts (even if
> handling short/long is ugly), removing long options (my favorite
> solution) and using our own implementation (the way which was chosen).
> Search the mailing list archives if you are interested.
> 

Thanks. :)

Marc


More information about the pacman-dev mailing list