FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 05-19-2008, 03:54 PM
Sebastian Nowicki
 
Default Fixing command line argument parsing in makepkg

I have not tested this on many systems, but when running into another
"bug", I noticed that makepkg doesn't parse command line options
correctly on Mac OS X:

> $ sudo makepkg --asroot
> ==> ERROR: Running makepkg as root is a BAD idea and can cause
> permanent, catastrophic damage to your system. If you
> wish to run as root, please use the --asroot option.

I'm not sure if this has something to do with my settings, or zsh (I did
test in bash), but there is a problem. After running getopt, it appears
$@ gets altered. The following is the output of makepkg with an
additional "echo $@" just after running getopt:

> $ makepkg -h
> -- AbcCdefFghiLmop:rRsSV -l
> ignorearch,asroot,builddeps,clean,cleancache,nodep s,noextract,force,fo
> rcever:,geninteg,help,holdver,install,log,nocolor, nobuild,rmdeps,repac
> kage,source,syncdeps,usesudo,version,noconfirm,nop rogressbar
> -n makepkg -- -h

makepkg proceeds as if -h was not supplied.

The patch in the following mail attempts to fix this by using $ARGLIST,
which does have the correct command line arguments. I did not test this
patch on linux or other systems, or really tested it much at all, but
the command line arguments do seem to get noticed and parsed properly. I
didn't really write the patch as a solution, I just wanted to bring
something to the table. I am not familiar with makepkg so it'd be best
for other people to look into this.

After applying the patch, $@ no longer gets shifted, and I saw use of
OPT_IND, which never gets used, but it did scare me off a bit. Not
shifting the command line arguments may result in regressions, but the
solution provided is a simple one.

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-20-2008, 07:58 PM
"Dan McGee"
 
Default Fixing command line argument parsing in makepkg

On Mon, May 19, 2008 at 10:54 AM, Sebastian Nowicki <sebnow@gmail.com> wrote:
>
> I have not tested this on many systems, but when running into another
> "bug", I noticed that makepkg doesn't parse command line options
> correctly on Mac OS X:
>
>> $ sudo makepkg --asroot
>> ==> ERROR: Running makepkg as root is a BAD idea and can cause
>> permanent, catastrophic damage to your system. If you
>> wish to run as root, please use the --asroot option.
>
> I'm not sure if this has something to do with my settings, or zsh (I did
> test in bash), but there is a problem. After running getopt, it appears
> $@ gets altered. The following is the output of makepkg with an
> additional "echo $@" just after running getopt:
>
>> $ makepkg -h
>> -- AbcCdefFghiLmop:rRsSV -l
>> ignorearch,asroot,builddeps,clean,cleancache,nodep s,noextract,force,fo
>> rcever:,geninteg,help,holdver,install,log,nocolor, nobuild,rmdeps,repac
>> kage,source,syncdeps,usesudo,version,noconfirm,nop rogressbar
>> -n makepkg -- -h
>
> makepkg proceeds as if -h was not supplied.
>
> The patch in the following mail attempts to fix this by using $ARGLIST,
> which does have the correct command line arguments. I did not test this
> patch on linux or other systems, or really tested it much at all, but
> the command line arguments do seem to get noticed and parsed properly. I
> didn't really write the patch as a solution, I just wanted to bring
> something to the table. I am not familiar with makepkg so it'd be best
> for other people to look into this.
>
> After applying the patch, $@ no longer gets shifted, and I saw use of
> OPT_IND, which never gets used, but it did scare me off a bit. Not
> shifting the command line arguments may result in regressions, but the
> solution provided is a simple one.

I just replied to your patch email, but did not mention when OPT_IND
actually gets used. I believe the idea was that any remaining args to
makepkg would get passed to pacman when/if it is called? But I may
just be crazy there.

-Dan

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-20-2008, 11:24 PM
Xavier
 
Default Fixing command line argument parsing in makepkg

Dan McGee wrote:
> I just replied to your patch email, but did not mention when OPT_IND
> actually gets used. I believe the idea was that any remaining args to
> makepkg would get passed to pacman when/if it is called? But I may
> just be crazy there.
>

I have no idea what is that stuff for, and anyone is welcome to
investigate
Just some history I found today :
http://projects.archlinux.org/?p=pacman.git;a=commitdiff;h=54b71f0427e87e6d52542 3df06f8a06f2b71c518

So before we were using getops / OPTIND. After that commit, we used
getopt / OPT_IND.
man getopts seems to mention what OPTIND is for.
man getopt doesnt say anything though...

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 02:35 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org