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

Dieter Plaetinck dieter at plaetinck.be
Wed Sep 16 15:15:55 EDT 2009


On Wed, 16 Sep 2009 13:40:37 -0500
Aaron Griffin <aaronmgriffin at gmail.com> wrote:

> On Wed, Sep 16, 2009 at 12:12 PM, Xavier <shiningxc at gmail.com> wrote:
> > 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 :)
> 
> Doh, I skipped over the "builtin" part :S
> 
> > 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 is what I meant
> 

My 2 cents: portability is important, and code conciseness is more important then having a fancy interface with many possibilities.
Isn't it just redundant/bloat to support both long and short ones?

Dieter


More information about the pacman-dev mailing list