From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <w.bumiller@proxmox.com>
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 CFF25BC0E8
 for <pbs-devel@lists.proxmox.com>; Thu, 21 Dec 2023 13:03:03 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id ADAFC18561
 for <pbs-devel@lists.proxmox.com>; Thu, 21 Dec 2023 13:03:03 +0100 (CET)
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))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Thu, 21 Dec 2023 13:03:02 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 6CBED48A67
 for <pbs-devel@lists.proxmox.com>; Thu, 21 Dec 2023 13:03:02 +0100 (CET)
Date: Thu, 21 Dec 2023 13:03:01 +0100
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Filip Schauer <f.schauer@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Message-ID: <rty4q3dz5af6aegnfomouaujbxfy6lykircsltxucibtxxmwmb@adg6l2slfbhy>
References: <20231214144824.100616-1-f.schauer@proxmox.com>
 <20231214144824.100616-3-f.schauer@proxmox.com>
 <ccc4uaslsrj67zrjeixmjwvofnqos4vuyp5e3a6niljmaovr4e@wl4dq2mjueiv>
 <086153c2-0458-409d-a241-2a2b02bbbb34@proxmox.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <086153c2-0458-409d-a241-2a2b02bbbb34@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.095 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 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
 T_SCC_BODY_TEXT_LINE    -0.01 -
 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: Re: [pbs-devel] [PATCH v3 proxmox 2/3] compression: Add support for
 symlinks in zip files
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 21 Dec 2023 12:03:03 -0000

On Thu, Dec 21, 2023 at 12:37:42PM +0100, Filip Schauer wrote:
> On 20/12/2023 14:20, Wolfgang Bumiller wrote:
> > With the link of a symlink being encoded in the contents, I wonder if we
> > should just do the same in the code. Not normally what I'd go for in
> > rust, but...
> > 
> > On Thu, Dec 14, 2023 at 03:48:21PM +0100, Filip Schauer wrote:
> > > Add support for symlinks to ZipEntry. A symlink is encoded by or-ing its
> > > attributes with S_IFLNK as seen in the kernel in
> > > include/uapi/linux/stat.h
> > > 
> > > Signed-off-by: Filip Schauer<f.schauer@proxmox.com>
> > > ---
> > >   proxmox-compression/src/zip.rs | 32 +++++++++++++++++++++++++-------
> > >   1 file changed, 25 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/proxmox-compression/src/zip.rs b/proxmox-compression/src/zip.rs
> > > index 069e8bc..a3b2346 100644
> > > --- a/proxmox-compression/src/zip.rs
> > > +++ b/proxmox-compression/src/zip.rs
> > > @@ -74,6 +74,7 @@ fn epoch_to_dos(epoch: i64) -> (u16, u16) {
> > >   pub enum FileType {
> > >       Directory,
> > >       Regular,
> > > +    Symlink(OsString),
> > ... then this enum could be #[repr(u32)] using the values from the hunk
> > below as discriminants here directly.
> > And without the OsString in there this could be all of `Clone + Copy +
> > Eq + PartialEq`, turning all the `matches!()` in this series into
> > comparisons with `==`.
> 
> 
> Do you want to pass the symlink target as an additional argument to
> add_entry? If so, add_entry would take an enum FileType, an Option
> content and an Option symlink_target. Depending on the FileType, at
> least one of the Options would be None. This approach does not seem very
> clean to me.

Why would it be a separate parameter? Target == Content.