🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #7562

Bug#1156414: git-buildpackage: gbp buildpackage deletes an existing export dir on early errors

#7562
From: Viorel Cernateanu
Date: Sat, 05 Dec 2026 09:20
38 lines
3107 bytes
Package: git-buildpackage
Version: 0.9.43
Severity: important
Tags: patch

Since 0.9.36 (c9cc8df4, "buildpackage: remove export_dir if build
fails"), gbp buildpackage also purges the export dir after errors. The
current check only looks at whether --git-export-dir is set, not
whether this run created the directory. This causes two problems:

1. If gbp fails after the export dir name is known but before the
export, an existing <export-dir>/<package>-<version> is deleted. A
successful run would have moved it to <dir>.obsolete.<time> instead.
This happens e.g. with a failing preexport hook or a missing upstream
tarball. For example, for a package foo with upstream version 1.0:

  $ mkdir -p ../ba/foo-1.0
  $ echo data > ../ba/foo-1.0/important.txt
  $ gbp buildpackage --git-export-dir=../ba --git-preexport=false
  gbp:info: Running Preexport hook
  gbp:error: Preexport-hook 'false' failed: it exited with 1

Afterwards ../ba/foo-1.0/important.txt is gone.

2. If gbp stops before the export dir name is known, for example
because of uncommitted changes or the wrong branch, RemoveTree(None)
raises a TypeError and a traceback follows the error message. This is
#1091554 again: 68768a2d went back to the old check to fix #1111340.

This merge request purges only when this run has created the export
tree, with tests for both cases, for #1111340 and for purging after a
failed build:
https://salsa.debian.org/agx/git-buildpackage/-/merge_requests/112

I set the severity to important because of the data loss in case 1,
like #1111340.

Viorel
Technical Details
Message-ID: <O6U5X-g6Ao-1@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Viorel Cernateanu <vrilutza@gmail.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1156414: git-buildpackage: gbp buildpackage deletes an existing export dir on early errors
Date: Sat, 05 Dec 2026 10:20:01 +0100
Message-ID: <O6U5X-g6Ao-1@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sat Dec  5 09:19:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: 1.401
Reply-To: Viorel Cernateanu <vrilutza@gmail.com>, 1156414@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: agx@sigxcpu.org
X-Debian-Pr-Message: report 1156414
X-Debian-Pr-Package: git-buildpackage
X-Debian-Pr-Keywords: patch
X-Debian-Pr-Source: git-buildpackage
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2007108
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 38
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sat, 05 Dec 2026 11:17:58 +0200
X-Original-Message-ID: <179646227815.175523.11848296401593138800@gmail.com>