From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-5.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A0C161F47C for ; Tue, 3 Jan 2023 20:41:16 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=cs.ucla.edu header.i=@cs.ucla.edu header.a=rsa-sha256 header.s=78364E5A-2AF3-11ED-87FA-8298ECA2D365 header.b=facJPWt/; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCo5t-0001ue-LD; Tue, 03 Jan 2023 15:41:09 -0500 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 1pCo5s-0001uN-6E for bug-gnulib@gnu.org; Tue, 03 Jan 2023 15:41:08 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCo5m-0005rp-Kq for bug-gnulib@gnu.org; Tue, 03 Jan 2023 15:41:07 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B7D3816004F; Tue, 3 Jan 2023 12:41:00 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 5Tt_-bbtlKfF; Tue, 3 Jan 2023 12:41:00 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E0A9F16005C; Tue, 3 Jan 2023 12:40:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.9.2 zimbra.cs.ucla.edu E0A9F16005C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=78364E5A-2AF3-11ED-87FA-8298ECA2D365; t=1672778459; bh=RVx5Ew+IsPkHxJGsnn3uj+rvgInqwC87Leeb20FBZcs=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type: Content-Transfer-Encoding; b=facJPWt/l+yYVjJ1hZpN27srTH9zXrCChAgR7vGAMvaG5TdWo7sBAZFbfPofYr4sY B5/2zttcXXIunO85L9q+nT4j9FdrW7MnPHmdGodeHuWWdMs/fMyDfpMSomawQItryl QVqDmpLHjRPre39J0y3+1QDKzOwfH+of95fGMJww= X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vC4x32p-y60A; Tue, 3 Jan 2023 12:40:59 -0800 (PST) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id B1F86160048; Tue, 3 Jan 2023 12:40:59 -0800 (PST) Message-ID: Date: Tue, 3 Jan 2023 12:40:58 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 To: Ondrej Valousek References: <20230103140816.1121699-1-ondrej.valousek.xm@renesas.com> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department Cc: bug-gnulib@gnu.org, kdudka@redhat.com Subject: Re: [PATCH] Use xattr (Linux) in copy-acl.c In-Reply-To: <20230103140816.1121699-1-ondrej.valousek.xm@renesas.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -73 X-Spam_score: -7.4 X-Spam_bar: ------- X-Spam_report: (-7.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, NICE_REPLY_A=-3.103, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Thanks again for looking into this. On 2023-01-03 06:08, Ondrej Valousek wrote: > +static int > +copy_attr_permissions (const char *name, struct error_context *ctx) > +{ > + int action = attr_copy_action (name, ctx); > + return action == ATTR_ACTION_PERMISSIONS; > +} This returns bool not int, so it should be declared to return bool. The body can be a one-liner, no? > +#ifdef USE_XATTR > + ret = chmod_or_fchmod (dst_name, dest_desc, mode); > + /* Rather than fiddling with acls one by one, we just copy the whole ACL xattrs > + * (Posix or NFSv4). Of course, that won't address ACLs conversion > + * (i.e. posix <-> nfs4) but we can't do it anyway, so for now, we don't care > + */ > + if(ret == 0) > + ret = source_desc <= 0 && dest_desc <= 0 > + ? attr_copy_file (src_name, dst_name, copy_attr_permissions, NULL) > + : attr_copy_fd (src_name, source_desc, dst_name, dest_desc, copy_attr_permissions, NULL); Please add brief commentary as to why we need both chmod_or_fchmod and attr_copy_* (i.e., why it doesn't suffice to just do the attr_copy_*), and why it's important to do chmod_or_fchmod before doing attr_copy_*? Also, please use Gnulib style in comments; no "*" on each line. Also, the test "source_desc <= 0 && dest_desc <= 0" looks wrong. Shouldn't it be "source_desc < 0 || dest_desc < 0"? > + if test $ac_cv_header_attr_libattr_h = yes \ > + && test $ac_cv_header_attr_error_context_h = yes; then Although quoting inside "" isn't needed for shell variables that you know have only safe characters, these ac_cv_* shell var uses should be quoted inside "" for safety, e.g., 'test "$ac_cv_header_attr_libattr_h" = yes', in case the user screws up and puts spaces into their values. Please do this systematically for ac_cv_* variables.