From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id BCD363939C0D for ; Wed, 7 Apr 2021 20:48:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BCD363939C0D Received: by mail-pj1-x102e.google.com with SMTP id nh5so8239090pjb.5 for ; Wed, 07 Apr 2021 13:48:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=DJ/nUTnshQYfv1jG3a0P1sDcSxF6B7dY7mt7R2v3woQ=; b=kBJNivO5FPZawlHQwOs/JE1Usf2EArXlHPzRhmuiDlnzdEVXVyJRgfMwaoZY0I6ZpM llfYDuDJB4Erp29R47+sBJNxK/UVFP3KED3U4xvlE9S9/s/mbB4Ro6gd7aBPZeQE84zm 9rPAI1SUhjlGCCUZoC8WSGaO79OLszPAeP4dAWnHT5/tPPI/ZyIiFJp4gGhre2e7gJtw kdphhpRSK3QgBia+xOD0scICiLblTQ9Qk7S8peD6c2yApGez6xsTo/W+D4w31X4jUMRb 21xg1f8389i2s49MrblCKISseehcQmcTQWZQc2zlB2c+D8enp/V9MJYYRw06yUtQJMAx qQig== X-Gm-Message-State: AOAM531fASnFUNKyA2zpurLcFYxT8VM9XzYWXIHBG+KNy24EbsvlAJZB GPfOHuuFywaBWFu3yr8MbkKdFUy5TOPIe0CS1GrEuUDQILSnmw== X-Google-Smtp-Source: ABdhPJxRQ7epWJWJAo9N1Hp/8nBk92nEhjytyC909pNXFMBwLCwSRnNQ6pQvsBp4v++2YwVunjQCu/yINCLagOyTpfA= X-Received: by 2002:a17:903:2082:b029:e9:f75:d0ce with SMTP id d2-20020a1709032082b02900e90f75d0cemr4641653plc.24.1617828480185; Wed, 07 Apr 2021 13:48:00 -0700 (PDT) MIME-Version: 1.0 From: Orgad Shaneh Date: Wed, 7 Apr 2021 23:47:48 +0300 Message-ID: Subject: A problem with noacl+umask+chmod result To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 20:48:03 -0000 Hi, If a filesystem is mounted with noacl, calling chmod to add write permissions after umasking this permission doesn't work. Demonstrated with command-line and C++. Did I miss something or is this a real bug? According to umask man, it should only affect newly created files and directories, but I didn't find anything that relates to chmod. Command-line: touch foo ls -l foo # -rw-r--r-- ... foo umask 200 chmod 0 foo ls -l foo # -r--r--r-- ... foo chmod 200 foo ls -l foo # -r--r--r-- ... foo # Expected to have rw C++: #include #include #include #include #include const char fileName[] = "foo"; const int mask = S_IWRITE; void get() { struct stat st; stat(fileName, &st); std::cout << (st.st_mode) << std::endl; } void set(int mode) { chmod(fileName, mode); } int main() { std::cout << std::oct; std::cout << "mask: " << mask << std::endl; close(open(fileName, O_WRONLY | O_CREAT)); get(); umask(mask); set(0); get(); set(mask); get(); } Output without noacl: mask: 200 100644 100444 100644 Output with noacl: mask: 200 100644 100444 100444 Thanks, - Orgad