From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam =?UTF-8?Q?Sj=C3=B8gren?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61326: Adding --no-add-suffix to zip patch Date: Mon, 06 Feb 2023 19:57:19 +0100 Organization: koldfront - analysis & revolution, Copenhagen, Denmark Message-ID: <87ilgeoc4w.fsf@tullinup.koldfront.dk> References: <87zg9qohk1.fsf@tullinup.koldfront.dk> Reply-To: Adam =?UTF-8?Q?Sj=C3=B8gren?= Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37638"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 61326@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 06 19:58:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pP6gw-0009WK-HB for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Feb 2023 19:58:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pP6go-0008PK-6Z; Mon, 06 Feb 2023 13:58:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP6gl-0007vG-J8 for bug-gnu-emacs@gnu.org; Mon, 06 Feb 2023 13:58:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pP6gk-0006O3-Cb for bug-gnu-emacs@gnu.org; Mon, 06 Feb 2023 13:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pP6gj-0001Bk-PV for bug-gnu-emacs@gnu.org; Mon, 06 Feb 2023 13:58:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87zg9qohk1.fsf@tullinup.koldfront.dk> Resent-From: Adam =?UTF-8?Q?Sj=C3=B8gren?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 18:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61326 X-GNU-PR-Package: emacs Original-Received: via spool by 61326-submit@debbugs.gnu.org id=B61326.16757098474511 (code B ref 61326); Mon, 06 Feb 2023 18:58:01 +0000 Original-Received: (at 61326) by debbugs.gnu.org; 6 Feb 2023 18:57:27 +0000 Original-Received: from localhost ([127.0.0.1]:49946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP6gA-0001Af-RP for submit@debbugs.gnu.org; Mon, 06 Feb 2023 13:57:27 -0500 Original-Received: from virgil.koldfront.dk ([212.237.178.116]:46964) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP6g7-0001AR-Fg for 61326@debbugs.gnu.org; Mon, 06 Feb 2023 13:57:24 -0500 Original-Received: from tullinup.koldfront.dk (tullinup.koldfront.dk [192.168.1.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by virgil.koldfront.dk (Postfix) with ESMTPS id 6AEF116C168F1 for <61326@debbugs.gnu.org>; Mon, 6 Feb 2023 19:57:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 virgil.koldfront.dk 6AEF116C168F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koldfront.dk; s=mail; t=1675709839; bh=8R6OIpfFZsQplsGjLndxTx+os09jSUoNVL9u5p2NN8E=; h=From:To:Subject:Date:From; b=KaxAAIjJKrH78+frvcrn8gFkX+kPP8slfJkvHyHKVWJvNhSo/shlwBfFIx9GHj+d3 ZnCV210TS3R4h1YZJB5s/ExG/lLK2rsAi8xsNsCtOZRj7Z8pysz+1y9ZGEf90ruVpF 00n0X7+ndZmIYP0Mubu51NptOLVoDxwaLd8piEoJCihtMD2u0kGThZdKZHg+0z2VDv ThGizm9YeyAMs99bzwwMjywqrJW61rOUMAR1Ht4szgt/u9WH9uJ/7ONEu7LmdWxP2Z xuarjjDn7DI4KENUlV7VmdCVa7O8hoN/rDREozLLpfLdAKG/duVbZ3IdVbGnm1VRia j3uryGSqloIKg== Original-Received: by tullinup.koldfront.dk (Postfix, from userid 1000) id 57558201E2A18; Mon, 6 Feb 2023 19:57:19 +0100 (CET) OpenPGP: id=476630590A231909B0A0961A49D0746121BDE416; url=https://asjo.koldfront.dk/gpg.asc X-Now-Playing: The Real Snow White, 4:13 Dream (The Cure) X-Face: )qY&CseJ?.:=8F#^~GcSA?F=9eu'{KAFfL1C3/A&:nE?PW\i65"ba0NS)97, Q(^@xk}n4Ou rPuR#V8I(J_@~H($[ym:`K_+]*kjvW>xH5jbgLBVFGXY:(#4P>zVBklLbdL&XxL\M)%T}3S/IS9lMJ ^St'=VZBR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254999 Archived-At: Adding a '--no-add-suffix' option to zip 3.0 is not too bad: diff -u orig/zip-3.0/globals.c chan/zip-3.0/globals.c --- orig/zip-3.0/globals.c 2008-05-25 19:26:38.000000000 +0200 +++ chan/zip-3.0/globals.c 2023-02-06 19:42:48.000000000 +0100 @@ -106,6 +106,7 @@ int noisy = 1; /* 0=quiet operation */ int extra_fields = 1; /* 0=create minimum, 1=don't copy old, 2=keep old */ int use_descriptors = 0; /* 1=use data descriptors 12/29/04 */ +int no_add_suffix = 0; /* 1=do not add suffix .zip to archive names without . */ int zip_to_stdout = 0; /* output zipfile to stdout 12/30/04 */ int allow_empty_archive = 0; /* if no files, create empty archive anyway 12/28/05 */ int copy_only = 0; /* 1=copying archive entries only */ diff -u orig/zip-3.0/zip.c chan/zip-3.0/zip.c --- orig/zip-3.0/zip.c 2023-02-06 19:49:42.000000000 +0100 +++ chan/zip-3.0/zip.c 2023-02-06 19:47:26.000000000 +0100 @@ -1942,6 +1942,7 @@ #ifdef UNICODE_TEST #define o_sC 0x146 #endif +#define o_nas 0x147 /* the below is mainly from the old main command line @@ -2042,6 +2043,7 @@ {"N", "notes", o_NO_VALUE, o_NOT_NEGATABLE, 'N', "add notes as entry comments"}, #endif {"o", "latest-time", o_NO_VALUE, o_NOT_NEGATABLE, 'o', "use latest entry time as archive time"}, + {"", "no-add-suffix", o_NO_VALUE, o_NOT_NEGATABLE, o_nas, "do not add .zip suffix to archive name without ."}, {"O", "output-file", o_REQUIRED_VALUE, o_NOT_NEGATABLE, 'O', "set out zipfile different than in zipfile"}, {"p", "paths", o_NO_VALUE, o_NOT_NEGATABLE, 'p', "store paths"}, {"P", "password", o_REQUIRED_VALUE, o_NOT_NEGATABLE, 'P', "encrypt entries, option value is password"}, @@ -2378,6 +2380,7 @@ before = 0; /* 0=ignore, else exclude files before this time */ after = 0; /* 0=ignore, else exclude files newer than this time */ + no_add_suffix = 0 /* 0=add .zip if no . as usual, else use archive name unchanged */ special = ".Z:.zip:.zoo:.arc:.lzh:.arj"; /* List of special suffixes */ key = NULL; /* Scramble password if scrambling */ key_needed = 0; /* Need scramble password */ @@ -3299,6 +3302,11 @@ break; #endif + case o_nas: + no_add_suffix = 1; + break; + + case o_NON_OPTION_ARG: /* not an option */ /* no more options as permuting */ @@ -3340,8 +3348,14 @@ #endif /* !MACOS && !WINDLL */ { /* name of zipfile */ - if ((zipfile = ziptyp(value)) == NULL) { - ZIPERR(ZE_MEM, "was processing arguments"); + if (no_add_suffix) { + zipfile = value; + } + else { + if ((zipfile = ziptyp(value)) == NULL) { + ZIPERR(ZE_MEM, "was processing arguments"); + } + free(value); } /* read zipfile if exists */ /* @@ -3349,7 +3363,6 @@ ZIPERR(r, zipfile); } */ - free(value); } if (show_what_doing) { fprintf(mesg, "sd: Zipfile name '%s'\n", zipfile); diff -u orig/zip-3.0/zip.h chan/zip-3.0/zip.h --- orig/zip-3.0/zip.h 2008-05-25 19:23:22.000000000 +0200 +++ chan/zip-3.0/zip.h 2023-02-06 19:43:41.000000000 +0100 @@ -442,6 +442,7 @@ extern int use_privileges; /* use security privilege overrides */ #endif extern int use_descriptors; /* use data descriptors (extended headings) */ +extern int no_add_suffix; /* do not add suffix .zip to archive names without . */ extern int allow_empty_archive; /* if no files, create empty archive anyway */ extern int copy_only; /* 1 = copy archive with no changes */ extern int zip_to_stdout; /* output to stdout */ But getting something like that accepted and distributed, and for Emacs to tell whether the installed zip has that option or not, seems like a lot of work.