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 11-05-2009, 06:01 PM
Cedric Staniewski
 
Default makepkg: fix abortion after sourcing /etc/profile

Cedric Staniewski wrote:
> The source command triggers / could trigger the ERR trap which makes
> makepkg abort right after a successful installation of missing dependencies.
>
> Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
> ---
> It works, but I'm totally clueless why. I would prefer a more obvious solution
> if we can find one (set +E ... set -E did not work for me).
>
> scripts/makepkg.sh.in | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 92b0454..81f20bb 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -371,10 +371,9 @@ handle_deps() {
> fi
>
> # we might need the new system environment
> - # set -e can cause problems during sourcing profile scripts
> - set +e
> - source /etc/profile &>/dev/null
> - set -e
> + # avoid triggering the ERR trap by running the
> + # source command in a subshell
> + $(source /etc/profile &>/dev/null)
>
> return $R_DEPS_SATISFIED
> }

This one is stupid, sorry. Makepkg does not abort anymore, but the source command is pointless now. So we have to find another way to work around this nice errtrace option.
 
Old 11-05-2009, 08:35 PM
Cedric Staniewski
 
Default makepkg: fix abortion after sourcing /etc/profile

Xavier wrote:
> On Thu, Nov 5, 2009 at 8:01 PM, Cedric Staniewski <cedric@gmx.ca> wrote:
>> Cedric Staniewski wrote:
>>> The source command triggers / could trigger the ERR trap which makes
>>> makepkg abort right after a successful installation of missing dependencies.
>>>
>>> Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
>>> ---
>>> It works, but I'm totally clueless why. I would prefer a more obvious solution
>>> if we can find one (set +E ... set -E did not work for me).
>>>
>>> scripts/makepkg.sh.in | 7 +++----
>>> 1 files changed, 3 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>> index 92b0454..81f20bb 100644
>>> --- a/scripts/makepkg.sh.in
>>> +++ b/scripts/makepkg.sh.in
>>> @@ -371,10 +371,9 @@ handle_deps() {
>>> fi
>>>
>>> # we might need the new system environment
>>> - # set -e can cause problems during sourcing profile scripts
>>> - set +e
>>> - source /etc/profile &>/dev/null
>>> - set -e
>>> + # avoid triggering the ERR trap by running the
>>> + # source command in a subshell
>>> + $(source /etc/profile &>/dev/null)
>>>
>>> return $R_DEPS_SATISFIED
>>> }
>> This one is stupid, sorry. Makepkg does not abort anymore, but the source command is pointless now. So we have to find another way to work around this nice errtrace option.
>>
>>
>
> So looks like http://bugs.archlinux.org/task/11179 is coming up again
> because of the new set -E
>
> I have been reading http://fvue.nl/wiki/Bash:_Error_handling
> Oh my god ! This stuff is so complex , it really hurts :P
>

Thanks for the link. I'm sure I already came across this page, but for some reason, I did not bookmark it. Maybe I will read through it some day (in a masochistic moment).

> I only understood half of what I was reading, which led to me to do
> many test, including this one :
>
> # we might need the new system environment
> # a trap on ERR can cause problems during sourcing profile scripts
> restoretrap=$(trap -p ERR)
> trap - ERR
> source /etc/profile &>/dev/null
> eval $restoretrap
>
> It looks like this did the trick for me (and set +e is no longer needed ?)
>

Looks good and seems to work. Maybe you could add a 'local' in front of restoretrap=... . Do you want to submit a patch with your code?

>
> Btw this problem is still caused by bash-completion.. It does not make
> sense to have makepkg load all that crap
>
>> >From /etc/profile.bash :
> # Source our global bashrc file, to remove duplication of effort
> [ -r /etc/bash.bashrc ] && . /etc/bash.bashrc
>
> Maybe this should only be done for interactive shells ? That would
> workaround the problem , right ?

At least on Arch Linux, I guess. By the way, does/can this whole thing actually work on other distributions?
 
Old 11-15-2009, 03:46 AM
Allan McRae
 
Default makepkg: fix abortion after sourcing /etc/profile

Xavier wrote:

On Tue, Nov 10, 2009 at 8:47 PM, Cedric Staniewski <cedric@gmx.ca> wrote:

The source command triggers / might trigger the ERR trap which makes
makepkg abort right after a successful installation of missing
dependencies.

Thanks to Xavier Chantry <shiningxc@gmail.com> for finding this
solution.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>

Thanks for doing this, I kinda forgot



Pushed to my working branch.

Allan
 

Thread Tools




All times are GMT. The time now is 08:36 AM.

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