From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BC36D68A4E for ; Fri, 10 Sep 2021 11:10:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AB4DE11B10 for ; Fri, 10 Sep 2021 11:09:49 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS id 21EC211B04 for ; Fri, 10 Sep 2021 11:09:49 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E13934466C for ; Fri, 10 Sep 2021 11:09:48 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Fri, 10 Sep 2021 11:09:48 +0200 Message-Id: <20210910090948.2145523-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.418 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [zip.rs] Subject: [pbs-devel] [RFC PATCH proxmox-backup] pbs-tools: zip: add EFS flag to zip files X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 09:10:19 -0000 this flag marks the file names as 'UTF-8' encoded. By default, encoding of file names in zips are defined as code page 437, but we save the filenames as bytes (like in linux fs). For linux systems this neither would be a problem since most tools simply use the filenames as bytes, but for the zip utility under windows it's important since NTFS uses UTF-16 for file names. Since we generate zips only on pxars (file based backup on linux) or via file-restore-daemons (linux; ntfs mounted as UTF-8), it's a fair assumption that we can mark most filenames as UTF-8. For zips generated from linux backups to be extracted on windows it is impossible to do the correct thing anyway, since windows can not have arbitrary bytes in file names, and for each encoding chosen, there is some file that cannot be shown correctly. so either all filenames are decoded as CP437 ('ö' -> '├╢') or non UTF-8 encoded file-names have garbage characters in them (�) Signed-off-by: Dominik Csapak --- sending as RFC since there is no way to have it correct in all cases, and we have to decide if we want CP437 or UTF-8 by default pbs-tools/src/zip.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pbs-tools/src/zip.rs b/pbs-tools/src/zip.rs index 605480a8..88eea07b 100644 --- a/pbs-tools/src/zip.rs +++ b/pbs-tools/src/zip.rs @@ -34,6 +34,8 @@ const VERSION_MADE_BY: u16 = 0x032d; const ZIP64_EOCD_RECORD: u32 = 0x06064B50; const ZIP64_EOCD_LOCATOR: u32 = 0x07064B50; +const GENERAL_PURUPOSE_FLAGS: u16 = (1 << 3) | (1 << 11); // EFS + Data Descriptor + // bits for time: // 0-4: day of the month (1-31) // 5-8: month: (1 = jan, etc.) @@ -249,7 +251,7 @@ impl ZipEntry { LocalFileHeader { signature: LOCAL_FH_SIG, version_needed: 0x2d, - flags: 1 << 3, + flags: GENERAL_PURUPOSE_FLAGS, compression: 0x8, time, date, @@ -332,7 +334,7 @@ impl ZipEntry { signature: CENTRAL_DIRECTORY_FH_SIG, version_made_by: VERSION_MADE_BY, version_needed: VERSION_NEEDED, - flags: 1 << 3, + flags: GENERAL_PURUPOSE_FLAGS, compression: 0x8, time, date, -- 2.30.2