[pacman-dev] [PATCH] makepkg: remove srclinks directory on error exit

Allan McRae allan at archlinux.org
Thu Dec 3 04:43:45 EST 2009


Cedric Staniewski wrote:
> On 12/03/2009 05:08 AM, Allan McRae wrote:
>> Cedric Staniewski wrote:
>>> When makepkg exits in create_srcpackage(), the (temporary) srclinks
>>> directory is left behind.
>>>
>>> Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
>>> ---
>>>  scripts/makepkg.sh.in |    1 +
>>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>> index ceaa8a6..b618881 100644
>>> --- a/scripts/makepkg.sh.in
>>> +++ b/scripts/makepkg.sh.in
>>> @@ -118,6 +118,7 @@ trap_exit() {
>>>          echo
>>>          error "$@"
>>>      fi
>>> +    [[ -n $srclinks ]] && rm -rf "$srclinks"
>>>      exit 1
>>>  }
>>>  
>> I am not sure about this as if the source package creation fails, I
>> would like to be able to look in the directory to track down why.  Much
>> like how "-c" does not clear the source directory on a build failure. So
>> my initial reaction is a -1.
>>
>> As an aside, did you actually encounter an error during source package
>> creation or just note that could be left behind from the code?
>>
> 
> I actually did not encounter an error but aborted via ctrl+c. Keeping
> this folder is useless in my opinion as there are error messages for
> pretty much everything and the three different external commands which
> are used (mkdir, ln, bsdtar) usually throw meaningful error messages,
> too. Aside from that this folder only contains smylinks anyway and I
> doubt they are useful for tracking down errors.
> 
> Another alternative would be introducing a new cleanup function which is
> only run on SIGINT and moving this line there, though.
> 

OK, your comment about the external commands being used having good 
error messages has me convinced something needs done.  It just seems a 
strange place for this particular clean up.  Saying that, I'm not sure 
what would be a better place unless we had an error trap just for that 
function which passed on to trap_exit.

Dan, Xavier, others: any comments?




More information about the pacman-dev mailing list