From patchwork Mon Dec 4 15:15:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roxana Nicolescu X-Patchwork-Id: 1871585 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkS0w24L2z23nJ for ; Tue, 5 Dec 2023 02:15:59 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rAAfh-000149-Md; Mon, 04 Dec 2023 15:15:45 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rAAfW-000141-6O for kernel-team@lists.ubuntu.com; Mon, 04 Dec 2023 15:15:34 +0000 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id D30A43F457 for ; Mon, 4 Dec 2023 15:15:33 +0000 (UTC) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4238180a464so74496411cf.2 for ; Mon, 04 Dec 2023 07:15:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701702933; x=1702307733; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9Hvbz1+QSsfSPmXg8Lh0Mdkv/kGxyfhBk6ki7cGPAdY=; b=Qs2SEgugM1rl0DfrDICjIwHLl7hiRSI2s5e7VbDxUb1rUk1BEqAvEu1Q62lUkQhW/T BXj5IcfgyBgockrb6z+wUt9VmJ53CMRql3tSvnG6f/eg+VWY+uHRQRKttP8y1FywMjCR 9uU9MwC5uzJlGeWi3TwKa+qit9zMN8Y+FYcs3i2bSISIUAitXWOQpNPNpG394n1VYkaC R57e3bMJGM6xSZzunjzirdeEE52IxBaxtOHSPgp6GBVOVItWYg6v+d99539OMkMeHyWF B7x4Drztqskzsj7WImI0AGCZBt0vWpAYzHkDchA4cXZQOdqiniisQS8VxCSj7r5MSEjq 7SPg== X-Gm-Message-State: AOJu0Yw4tfsRN6sz8n9BjaWYuyJDhHhe6MrLBayrRZYPQfXO7OzWogkJ L9A9eTciq6WNrSMqofZyx9mFQPTNiyqr2QMdNFaJGvVvNfvZ0IuxkrUqWVsjJwPBKkvIO/UYEpe mopRFgXyQlV6MWceAeGMXg0Uaoshih/+p7TCYfMHdei7ybFoforCm X-Received: by 2002:ac8:5988:0:b0:423:a3c9:8e70 with SMTP id e8-20020ac85988000000b00423a3c98e70mr6576261qte.17.1701702932885; Mon, 04 Dec 2023 07:15:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJDfilim71iG/MMhEWENGs/HIm4HUBEBg1qNbgd6nDTZ5CUHtnh2xhZHv4Dfx/RLcrqQezBg== X-Received: by 2002:ac8:5988:0:b0:423:a3c9:8e70 with SMTP id e8-20020ac85988000000b00423a3c98e70mr6576250qte.17.1701702932604; Mon, 04 Dec 2023 07:15:32 -0800 (PST) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c490]) by smtp.gmail.com with ESMTPSA id f8-20020ac81348000000b0042542920ec9sm2457909qtj.27.2023.12.04.07.15.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 07:15:32 -0800 (PST) From: Roxana Nicolescu To: kernel-team@lists.ubuntu.com Subject: [SRU][N, U][M, L, J, F][PATCH] UBUNTU: [Debian] autoreconstruct - Do not generate chmod -x for deleted files Date: Mon, 4 Dec 2023 16:15:25 +0100 Message-Id: <20231204151525.125225-1-roxana.nicolescu@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2045562 Debian source format 1.0 cannot remove files, create symlinks and change permission in the .diff.gz tarball. Therefore any changes in these 3 categories cannot be represented without any tricks. To solve this, the `reconstruct` script is used every time we build the source package. The script is generated by `gen-auto-reconstruct` script during `cranky close`. It checks if there has been any changes in the 3 categories mentioned above between the upstream version (i.e v6.5) and the current one. The problem with the script is that in case a file A was removed since the upstream version was released, the `reconstruct` script will contains these commands in this exact order: rm -f A chmod -x A The second command will fail because file A does not exist anymore. This is solved by generating the `chmod +/-x` commands before `rm`. Which results in: chmod -x A rm -f A But because the reconstruct script is used during `clean` rule which is triggered pretty much during every cranky step which is run in the source repo, the first command will always file because file A is not present anymore in the tree. To solved this, any `chmod` change is added only if the file has not been deleted. Therefore if file A has been deleted, the `reconstruct` script will contain only this: rm -f A Signed-off-by: Roxana Nicolescu Acked-by: Dimitri John Ledkov Acked-by: Manuel Diewald --- debian/scripts/misc/gen-auto-reconstruct | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/debian/scripts/misc/gen-auto-reconstruct b/debian/scripts/misc/gen-auto-reconstruct index a50ceb619f17..87a6ff6ef0f0 100755 --- a/debian/scripts/misc/gen-auto-reconstruct +++ b/debian/scripts/misc/gen-auto-reconstruct @@ -34,14 +34,6 @@ fi echo "[ ! -L '$name' ] && ln -sf '$link' '$name'" done - # Identify all removed files since the proffered tag. - echo "# Remove any files deleted from the orig." - git diff "$tag.." --raw --no-renames | awk '(/^:/ && $5 == "D") { print $NF }' | \ - while read name - do - echo "rm -f '$name'" - done - # Identify files with execute permissions added since the proffered tag. git diff "$tag.." --raw --no-renames | awk -F '[: \t]' '{print $2, $3, $NF }' | \ while IFS=" " read old new name @@ -53,12 +45,20 @@ fi added=$(( new & 0111 )) if [ "$added" -ne 0 ]; then echo "chmod +x '$name'" - else + elif [ "$new" -ne 0 ]; then echo "chmod -x '$name'" fi fi done + # Identify all removed files since the proffered tag. + echo "# Remove any files deleted from the orig." + git diff "$tag.." --raw --no-renames | awk '(/^:/ && $5 == "D") { print $NF }' | \ + while read name + do + echo "rm -f '$name'" + done + # All done, make sure this does not complete in error. echo "exit 0" ) >"$reconstruct"