From unknown Sun Jul 27 09:36:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50012: [PATCH] df: Fixed usage of incorrect stat data when using automount Resent-From: Thimo Emmerich Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 11 Aug 2021 16:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50012 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 50012@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162869765412246 (code B ref -1); Wed, 11 Aug 2021 16:01:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Aug 2021 16:00:54 +0000 Received: from localhost ([127.0.0.1]:36359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDqez-0003BR-Kc for submit@debbugs.gnu.org; Wed, 11 Aug 2021 12:00:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:50510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDqdx-00037x-Hj for submit@debbugs.gnu.org; Wed, 11 Aug 2021 11:59:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDqdx-0004L5-83 for bug-coreutils@gnu.org; Wed, 11 Aug 2021 11:59:49 -0400 Received: from mx08-001d1705.pphosted.com ([185.183.30.70]:11250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDqdr-00043l-C7 for bug-coreutils@gnu.org; Wed, 11 Aug 2021 11:59:48 -0400 Received: from pps.filterd (m0209323.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17BFsFfP010440 for ; Wed, 11 Aug 2021 15:59:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : subject : to : message-id : date : content-type : mime-version; s=S1; bh=KoDZOgPObL4ac4Q7Zy3/pYv78VsHsdfezBa7SIhs8xA=; b=oUfO9P9SeM0YMTHqrLKqbozlmnSyAOJO98iqNHJGSDbLVUwIB2qNfj4zFkWvoYQTqCGv xJH4XD061lLpVRE77alhUpcFRHPgxHpSqwZAGDCgBHvW5fw95FjqX/McZLv2TP9JxPyd igaEC4NHdDMd/3khzul260tZxO8Um2boaCNbNy84ND3ftoOCie7Slxl3SHvqA+EPHhlK KXKU++aTPMu6LrMMdWhPLbHyBLg0WYSQbcNLHcsa4VdJNNJTeSwBd/P/ITyUMfVP1urZ RjRq43sWvBioYj35i0gySVjs+b1NwZq41jtIQ4odCgX4AC9+oWEON+IsbjFm+K9S9ZTF RA== Received: from eur02-he1-obe.outbound.protection.outlook.com (mail-he1eur02lp2058.outbound.protection.outlook.com [104.47.5.58]) by mx08-001d1705.pphosted.com with ESMTP id 3aadmr4fra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 11 Aug 2021 15:59:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bSeLn2cpvZzuxzy8M+gHj3riYjQ9zKKw1uhCezYgLv+obuyDZ7ElkgOsV+TwnNlU9xzJHEHtHKy1+qdHObaVqzkPvS2mvwT0rjjzcrJ3plgTyaTirer6cr/SinZTHQMXVcKkcluoQUJLe8y33ecy3eZxalW3nCQF3Ybqn81ZlaV2YqT0MbLQ/b4iraiTZhTKzL0zL4Ma2cKESjHNdwjyQ8SrIwmPwmuvGC1gsLu9taXb/lf7TWbbB7nJe67LP4UlMGunWyRqKCM5pwk36PRwuJqKsd6NFtlYFAinRw+qp06ONUeeKQsWb6DgA91sMJfmLWv+eDLGKXrOALrmybv+/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KoDZOgPObL4ac4Q7Zy3/pYv78VsHsdfezBa7SIhs8xA=; b=Igt+jSZ2G59Vp0fb/KgYlUSvMcXntIz9ANzjfjqX1HThekRvsdmGohBxF1x/Cgecwy82csmJ2pKbYMPED3BTrNmrTw/Og0y/NmmcCViNkJDF1VvZrqRAebXKQRl8rGRlgQfLaPi1Oble3NWgixvYRwkbX9lc4Hda7gb/MBv/J/8id1cYuGgD9Wauz5TGnm4R3ok4eqV031kJE5R59G8l3miqJaPebzAI5noOa/jsXy4DzbfEufPT/Pufq2pwH7ZfTzMIJcCzA7Od9WksEYwfhkvpVy2ZvqqunxLOgl284syZ9ZYLOOZoEQeuT14HjL6mRPApgpVKx/oZyg8qm6eNwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Authentication-Results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=sony.com; Received: from VI1P193MB0717.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:158::21) by VI1P193MB0494.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:157::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.15; Wed, 11 Aug 2021 15:59:31 +0000 Received: from VI1P193MB0717.EURP193.PROD.OUTLOOK.COM ([fe80::c993:abef:dc9a:a7a2]) by VI1P193MB0717.EURP193.PROD.OUTLOOK.COM ([fe80::c993:abef:dc9a:a7a2%9]) with mapi id 15.20.4415.016; Wed, 11 Aug 2021 15:59:30 +0000 From: Thimo Emmerich Message-ID: Date: Wed, 11 Aug 2021 17:59:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 Content-Type: multipart/alternative; boundary="------------14DA615DD2D97B41F185470E" Content-Language: en-GB X-ClientProxiedBy: PR0P264CA0199.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1f::19) To VI1P193MB0717.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:158::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [43.196.186.66] (157.68.5.3) by PR0P264CA0199.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Wed, 11 Aug 2021 15:59:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8d6fba61-8294-4edb-5daf-08d95ce10131 X-MS-TrafficTypeDiagnostic: VI1P193MB0494: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YFfmHVMc779kH03Ow7OZt3oYoKBLwefbACdkG4DZw0ljwfrQZJU3SbofUKN2GxS0d4Bl5ysyllhcHSU9h0puuQUXdqGaE+PK+WAEHoPI6+5vYCMQs8XjdMrh+CPKYl4gy712FdObrTVbbO6NFzSen+NPY8E9FYMq38SVZejDrgjK9xU2mNR0DGpVZvjCbuxvBZ+6vc1wmvkF+URPY1MPQdd9/TTTQoUQPx0CMyX4aqzIgf4J8pmaTPyh608gMxcGGv2VQZN/71X8gVJbLlNvTVcC47/Si/ajxLUtqJdLyF29drA0uucn2HOufNiEEAY3Hk8xG0KHRtq6uCHcf1UFt2LnKry5bXnv81iemaqyZD+9FXwqQDOmj2grXkz6qyPcXtSMflKl0iXvgP14ostUYjyJ8hxZ91wqtX/zxiibMwDhELjVid5eOsHbzY/iyaPAfOibArsvtyVb3KlMoHJUK/OaY724lz8er6A7KEXUIcLVyf6fLA9mEPorzTAjGizbNdkAO0/BZovFZ2M3pqt4RTMKjhe1K22rHJVB7fU70YnsKY84k9G7U43LfQdYPjIrPryJ2Lqc7wc+G/izOPmZB66Wv2TCuJN7dYawjSq0+xtBdciVZ02n3QNdo5zz2EJFEr6KoXO3XTXYO/RrV+LYkLVOhOKULFZX4bkrVmglwlh/SPM9+AVWSmLcFydzqTCdCpcSZIl4FSJU+zV3i4VKx6WPavKiWsfVfMssnYFlTWnL2X1POhQ42WZqugmXbDKOkgL0ZspxIGDeS9MxsRM4gCFwBfyUpjWUbJxD/VhByT6L9+8TxLs0UuaT6xL7cEBmOPiqnaxpRuYbr/SNlRntICQD4KNauZINTw1fl278xaWy1unG53bB4ba0bA0Z7HikFhhq6d9wP2uAmzN8uBKQBjt6suWcqX1+zF1uTE/P+bY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1P193MB0717.EURP193.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(396003)(39850400004)(376002)(136003)(8676002)(2906002)(5660300002)(38350700002)(38100700002)(186003)(33964004)(956004)(8936002)(6706004)(2616005)(26005)(53546011)(36756003)(31686004)(52116002)(6486002)(16576012)(478600001)(966005)(316002)(83380400001)(166002)(21615005)(44832011)(6916009)(66946007)(86362001)(66476007)(66556008)(31696002)(78286007)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2Isklem9+idHyXUcg+ZkdziJl1RJmCFdgLXPooNHkbykOwqPbY2rncvCV7zRWrmKBPJj3W2ynFzcfRBHg5TEf4rhVyN6ekLrbYLx6L0/vTO6sryprow5RQsPDCtBOJUqQA1UtzckoBVVOJ3JYdXV4vJtwuq5qNYHIkBidqOQgBQ2O1PxvqT4k3lGgASgGaBAuNT0l+6QBYHIVxpHSrQXS08eHeSqbytxHnR38gItkQdh2D1TAjnWk8q++Y5dOx7A1Y/csYaMpNVTxktpsy4j0CbeYXbZinWsn/PcKZ0tATK57qUPXNpzJRMJp5NzGdoSnemIr603N626L1o65NfRhxkmPm74eafThvKKDm4s+PMWTi/v9yZgmGqPoE4VI8fwu+g31l9bSK/D09qfRTvphEmxWUOpgb+fNSAAq//bcfkN6dOwi2UwKHmnXpQsnsdnHrvu+cm4EsbAoPoOqrK8PP7V+rqG+PtlhS66odGYt/BbGw/JEF520iAuoiVq3ikm1Tk0+Uze+kQQWFNw1aXFYc9QrTaFP8vVDZ1JZaZSXJavo3Yv5xpWDdkZURoqMMsDp/b0Dm7z7sGhL0xRTefYrJTNdVqZgKWTbdkD5t6ijvuMq/+uj5a45fD08bQ1DxQ3EpPN9lirAHurQDG61Rl/yBlPOzlDlIgodsGHqdLFcsbh49EDRyu6ovqwZnTx64nTptvFBVa52DbUdQdo1E3M1atVdNPYuGWmR7Nt87W8cHbH7eWUsptSl0UP0QWwtolEoOLCWzmgGzUHvEQ4ue42JAr+WVCioplVlgQQXdSvO1IZ+eQwOcBRaYpR3kV8of6BFgx/RnkLm5xp4VzClIXL00cZ/PYstKOZNYHqOC+aF8SdsQE6Q54XuhY5inUBylbpl9GVAhtv3G8gd2tbgKqcM8PuIY1pw4U7Nv2Y95xdIbuWTj5EwyxNQuMq98phdfw++tTwVxQm+r4w1StAC+SkCDhyiXemJDBO/hFNyUuWdSgkaSG15Vmbo4AQiMpI8RUGWitbaT24TgqgHSyt0CW6zDJdbvYr0GSHQfYlFpnsCmSTrWeKU+OuDLIC/2CrBBirCwI4KzOhAWvKUElptYy4oVXl/j7UjRIiLR+37p/e3nZG07qLn1cnR3lgK42BkNX858fPUNZ4HwkiB0pXTKoRjzuUnYN8GbXBID+Weblk/jzk+05Lel1Vs7qxPysosipt3aN2EcbP6Lj7rKgqqq6w7CJc3mrLnmbUqUx1pRY8nxDzQOt4HN2lMeHepXDcGT54Zm0n7dowNNFkXHVlzvZzWrO6WD1M4Hisap4H7hoanFrUpaRJFT8CcQjyVQ9X+31t X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d6fba61-8294-4edb-5daf-08d95ce10131 X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0717.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 15:59:30.8907 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CLlt/C/aM3dO1HYXKqy3WE8d56yhCI3a5ZZYbJpRv3hmlBGnoCOVlVkP4fjynho4STqflsp19BxMdvQuOQ5h0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P193MB0494 X-Proofpoint-ORIG-GUID: 8OMyMZn2PKRDJxGxuLFtuc7R0pe5N8MZ X-Proofpoint-GUID: 8OMyMZn2PKRDJxGxuLFtuc7R0pe5N8MZ X-Sony-Outbound-GUID: 8OMyMZn2PKRDJxGxuLFtuc7R0pe5N8MZ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-11_05:2021-08-11, 2021-08-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 clxscore=1011 impostorscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108110107 Received-SPF: pass client-ip=185.183.30.70; envelope-from=Thimo.Emmerich@sony.com; helo=mx08-001d1705.pphosted.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Mailman-Approved-At: Wed, 11 Aug 2021 12:00:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --------------14DA615DD2D97B41F185470E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit This seems to be a regression from b04ce61958c1: "df: fix hang with fifo argument". When using df on an browsable automount map (in my case NFS mounts) df returns a screwed up information if the mount is not existing. During execution it triggers the mount via open() but it uses previously collected stat information for the output. A second run leads to the correct information due to the mount in the first run. Example: me@app07:/psg$ ls -ld psg01bu drwxr-xr-x 2 root root 0 Jul 23 17:33 psg01bu me@app07:/psg$ df -h psg01bu Filesystem      Size  Used Avail Use% Mounted on auto_psg        2.0T   80M  1.9T   1% /psg me@app07:/psg$ ls -ld psg01bu drwxrwsr-x 2 root abc 4096 May  5 11:37 psg01bu me@app07:/psg$ df -h psg01bu Filesystem               Size  Used Avail Use% Mounted on fil36:/vg1/lv06/psg01bu  2.0T   80M  1.9T   1% /psg/psg01bu This behaviour could be observed on Ubuntu 20.04's stock df command (coreutils 8.30-3ubuntu2) as well as on latest GIT master. An old CentOS 7 machine is not affected. In general the comment in df.h "stat each of the given entries to make sure any corresponding partition is automounted." is suspicious since in [1] it is explicitly stated that "Any access to this directory beyond a “stat” will (normally) cause the d_op->d_automount() dentry operation to be called.". Since the stat in [2]/df.c, line 1775 is necessary for the following fifo evaluation, it seems to be necessary to update the stat information after a successful open. Best regards,  Thimo [1]: https://www.kernel.org/doc/html/latest/filesystems/autofs.html [2]: https://github.com/coreutils/coreutils/blob/master/src/df.c#L1775 From a586ab553d9e6f463049349a8ca88d7e727804df Mon Sep 17 00:00:00 2001 From: Thimo Emmerich Date: Wed, 11 Aug 2021 17:50:22 +0200 Subject: [PATCH] df: Fixed usage of incorrect stat data when using automount This code re-runs stat() after open()ing to update possibly invalid data. Invalid data can occur in case of using df on an unmounted directory in a browsable automount map. ---  src/df.c | 16 +++++++++++-----  1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/df.c b/src/df.c index 4534935f5..a5288cb6a 100644 --- a/src/df.c +++ b/src/df.c @@ -1766,9 +1766,10 @@ main (int argc, char **argv)    if (optind < argc)      { -      /* stat each of the given entries to make sure any corresponding -         partition is automounted.  This must be done before reading the -         file system table.  */ +      /* get the stat() information for the fifo check. +         In case of a browsable automount map this stat will +         not trigger the mount. Thus the information needs +         to be updated.  */        stats = xnmalloc (argc - optind, sizeof *stats);        for (int i = optind; i < argc; ++i)          { @@ -1780,10 +1781,15 @@ main (int argc, char **argv)              }            else if (! S_ISFIFO (stats[i - optind].st_mode))              { -              /* open() is needed to automount in some cases.  */ +                /* open() each of the given entries to make sure any corresponding +                 partition is automounted.  This must be done before reading the +                 file system table.  */                int fd = open (argv[i], O_RDONLY | O_NOCTTY);                if (0 <= fd) -                close (fd); +                { +                  close (fd); +                  stat (argv[i], &stats[i - optind]); +                }              }          }      } -- 2.25.1 -- Mit freundlichen Grüßen / with kind regards Thimo Emmerich ------------------------------------------- R&D Center Europe Stuttgart Laboratory 01 Phone: +49 (0) 711 / 5858 - 282 E-mail: thimo.emmerich@eu.sony.com Sony Europe B.V., Zweigniederlassung Deutschland Stuttgart Technology Center Hedelfinger Str. 61, 70327 Stuttgart, Germany Registered at the Court of Berlin-Charlottenburg HRB 129332 B Main Establishment: Sony Europe B.V. Registered Office: The Heights, Brooklands, Weybridge, Surrey, KT13 0XW, UK Incorporated in the Netherlands No. 71682147 Directors: Hideyuki Furumi, Masaki Kurebayashi, Ricky Londema --------------14DA615DD2D97B41F185470E Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit This seems to be a regression from b04ce61958c1: "df: fix hang with fifo argument".
When using df on an browsable automount map (in my case NFS mounts) df returns a screwed up information if the mount is not existing.
During execution it triggers the mount via open() but it uses previously collected stat information for the output.
A second run leads to the correct information due to the mount in the first run.
Example:
me@app07:/psg$ ls -ld psg01bu
drwxr-xr-x 2 root root 0 Jul 23 17:33 psg01bu
me@app07:/psg$ df -h psg01bu
Filesystem      Size  Used Avail Use% Mounted on
auto_psg        2.0T   80M  1.9T   1% /psg
me@app07:/psg$ ls -ld psg01bu
drwxrwsr-x 2 root abc 4096 May  5 11:37 psg01bu
me@app07:/psg$ df -h psg01bu
Filesystem               Size  Used Avail Use% Mounted on
fil36:/vg1/lv06/psg01bu  2.0T   80M  1.9T   1% /psg/psg01bu


This behaviour could be observed on Ubuntu 20.04's stock df command (coreutils 8.30-3ubuntu2) as well as on latest GIT master. An old CentOS 7 machine is not affected.

In general the comment in df.h "stat each of the given entries to make sure any corresponding partition is automounted." is suspicious since in [1] it is explicitly stated that "Any access to this directory beyond a “stat” will (normally) cause the d_op->d_automount() dentry operation to be called.".

Since the stat in [2]/df.c, line 1775 is necessary for the following fifo evaluation, it seems to be necessary to update the stat information after a successful open.

Best regards,
 Thimo

[1]: https://www.kernel.org/doc/html/latest/filesystems/autofs.html
[2]: https://github.com/coreutils/coreutils/blob/master/src/df.c#L1775

From a586ab553d9e6f463049349a8ca88d7e727804df Mon Sep 17 00:00:00 2001
From: Thimo Emmerich <thimo.emmerich@sony.com>
Date: Wed, 11 Aug 2021 17:50:22 +0200
Subject: [PATCH] df: Fixed usage of incorrect stat data when using automount

This code re-runs stat() after open()ing to update possibly
invalid data. Invalid data can occur in case of using df on
an unmounted directory in a browsable automount map.
---
 src/df.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/df.c b/src/df.c
index 4534935f5..a5288cb6a 100644
--- a/src/df.c
+++ b/src/df.c
@@ -1766,9 +1766,10 @@ main (int argc, char **argv)
 
   if (optind < argc)
     {
-      /* stat each of the given entries to make sure any corresponding
-         partition is automounted.  This must be done before reading the
-         file system table.  */
+      /* get the stat() information for the fifo check.
+         In case of a browsable automount map this stat will
+         not trigger the mount. Thus the information needs
+         to be updated.  */
       stats = xnmalloc (argc - optind, sizeof *stats);
       for (int i = optind; i < argc; ++i)
         {
@@ -1780,10 +1781,15 @@ main (int argc, char **argv)
             }
           else if (! S_ISFIFO (stats[i - optind].st_mode))
             {
-              /* open() is needed to automount in some cases.  */
+                /* open() each of the given entries to make sure any corresponding
+                 partition is automounted.  This must be done before reading the
+                 file system table.  */
               int fd = open (argv[i], O_RDONLY | O_NOCTTY);
               if (0 <= fd)
-                close (fd);
+                {
+                  close (fd);
+                  stat (argv[i], &stats[i - optind]);
+                }
             }
         }
     }
--
2.25.1


-- 
Mit freundlichen Grüßen / with kind regards

  Thimo Emmerich

-------------------------------------------

R&D Center Europe Stuttgart Laboratory 01

Phone:    +49 (0) 711 / 5858 - 282
E-mail:   thimo.emmerich@eu.sony.com

Sony Europe B.V., Zweigniederlassung Deutschland
Stuttgart Technology Center
Hedelfinger Str. 61, 70327 Stuttgart, Germany

Registered at the Court of Berlin-Charlottenburg HRB 129332 B

Main Establishment: Sony Europe B.V.
Registered Office: The Heights, Brooklands, Weybridge, Surrey, KT13 0XW, UK
Incorporated in the Netherlands No. 71682147
Directors: Hideyuki Furumi, Masaki Kurebayashi, Ricky Londema
--------------14DA615DD2D97B41F185470E-- From unknown Sun Jul 27 09:36:05 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Thimo Emmerich Subject: bug#50012: closed (Re: bug#50012: [PATCH] df: Fixed usage of incorrect stat data when using automount) Message-ID: References: <413d2c76-8868-8605-2416-cbc11c286de6@cs.ucla.edu> X-Gnu-PR-Message: they-closed 50012 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: patch Reply-To: 50012@debbugs.gnu.org Date: Wed, 11 Aug 2021 18:25:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1628706301-10953-1" This is a multi-part message in MIME format... ------------=_1628706301-10953-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #50012: [PATCH] df: Fixed usage of incorrect stat data when using automount which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 50012@debbugs.gnu.org. --=20 50012: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D50012 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1628706301-10953-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 50012-done) by debbugs.gnu.org; 11 Aug 2021 18:24:18 +0000 Received: from localhost ([127.0.0.1]:36526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDstm-0002pM-8A for submit@debbugs.gnu.org; Wed, 11 Aug 2021 14:24:18 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:35688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDstj-0002p7-Lg for 50012-done@debbugs.gnu.org; Wed, 11 Aug 2021 14:24:17 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 71C0A160099; Wed, 11 Aug 2021 11:24:09 -0700 (PDT) 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 C-TcaOPK7kEs; Wed, 11 Aug 2021 11:24:04 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id BDA5C1600FB; Wed, 11 Aug 2021 11:24:04 -0700 (PDT) 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 uXhJe5xLjvbO; Wed, 11 Aug 2021 11:24:04 -0700 (PDT) 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 95547160099; Wed, 11 Aug 2021 11:24:04 -0700 (PDT) Subject: Re: bug#50012: [PATCH] df: Fixed usage of incorrect stat data when using automount To: Thimo Emmerich References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <413d2c76-8868-8605-2416-cbc11c286de6@cs.ucla.edu> Date: Wed, 11 Aug 2021 11:24:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------DCB9D32D0BD7588B8E1A94FF" Content-Language: en-US X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 50012-done Cc: 50012-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.4 (---) This is a multi-part message in MIME format. --------------DCB9D32D0BD7588B8E1A94FF Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 8/11/21 8:59 AM, Thimo Emmerich wrote: > Since the stat in [2]/df.c, line 1775 is necessary for the following > fifo evaluation, it seems to be necessary to update the stat information > after a successful open. Thanks for reporting the bug. I installed the attached. It differs a bit from what you proposed in that it prefers fstat to stat, as fstat should be a bit faster and should avoid some unlikely races (there are many more races, but one fix at a time). --------------DCB9D32D0BD7588B8E1A94FF Content-Type: text/x-patch; charset=UTF-8; name="0001-df-fix-bug-with-automounted.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-df-fix-bug-with-automounted.patch" >From 48f59e058b4347172496bede193ade9fbf94d58e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 11 Aug 2021 11:16:05 -0700 Subject: [PATCH] df: fix bug with automounted If the command-line argument is automounted, df would use stat info that became wrong after the following open. * NEWS: Mention the fix (bug#50012). * src/df.c (automount_stat_err): New function. This fixes the hang on fifos in a better way, by using O_NONBLOCK. (main): Use it. --- NEWS | 3 +++ src/df.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 49ee083e4..e14de1397 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,9 @@ GNU coreutils NEWS -*- outline -*- df no longer outputs duplicate remote mounts in the presence of bind mounts. [bug introduced in coreutils-8.26] + df no longer mishandles command-line args that it pre-mounts + [bug introduced in coreutils-8.29] + du no longer crashes on XFS file systems when the directory hierarchy is heavily changed during the run. [bug introduced in coreutils-8.25] diff --git a/src/df.c b/src/df.c index 4534935f5..48025b9fc 100644 --- a/src/df.c +++ b/src/df.c @@ -276,6 +276,28 @@ static struct option const long_options[] = {NULL, 0, NULL, 0} }; +/* Stat FILE and put the results into *ST. Return 0 if successful, an + error number otherwise. Try to open FILE before statting, to + trigger automounts. */ + +static int +automount_stat_err (char const *file, struct stat *st) +{ + int fd = open (file, O_RDONLY | O_NOCTTY | O_NONBLOCK); + if (fd < 0) + { + if (errno == ENOENT || errno == ENOTDIR) + return errno; + return stat (file, st) == 0 ? 0 : errno; + } + else + { + int err = fstat (fd, st) == 0 ? 0 : errno; + close (fd); + return err; + } +} + /* Replace problematic chars with '?'. Since only control characters are currently considered, this should work in all encodings. */ @@ -1772,19 +1794,13 @@ main (int argc, char **argv) stats = xnmalloc (argc - optind, sizeof *stats); for (int i = optind; i < argc; ++i) { - if (stat (argv[i], &stats[i - optind])) + int err = automount_stat_err (argv[i], &stats[i - optind]); + if (err != 0) { - error (0, errno, "%s", quotef (argv[i])); + error (0, err, "%s", quotef (argv[i])); exit_status = EXIT_FAILURE; argv[i] = NULL; } - else if (! S_ISFIFO (stats[i - optind].st_mode)) - { - /* open() is needed to automount in some cases. */ - int fd = open (argv[i], O_RDONLY | O_NOCTTY); - if (0 <= fd) - close (fd); - } } } -- 2.30.2 --------------DCB9D32D0BD7588B8E1A94FF-- ------------=_1628706301-10953-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Aug 2021 16:00:54 +0000 Received: from localhost ([127.0.0.1]:36359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDqez-0003BR-Kc for submit@debbugs.gnu.org; Wed, 11 Aug 2021 12:00:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:50510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDqdx-00037x-Hj for submit@debbugs.gnu.org; Wed, 11 Aug 2021 11:59:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDqdx-0004L5-83 for bug-coreutils@gnu.org; Wed, 11 Aug 2021 11:59:49 -0400 Received: from mx08-001d1705.pphosted.com ([185.183.30.70]:11250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDqdr-00043l-C7 for bug-coreutils@gnu.org; Wed, 11 Aug 2021 11:59:48 -0400 Received: from pps.filterd (m0209323.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17BFsFfP010440 for ; Wed, 11 Aug 2021 15:59:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : subject : to : message-id : date : content-type : mime-version; s=S1; bh=KoDZOgPObL4ac4Q7Zy3/pYv78VsHsdfezBa7SIhs8xA=; b=oUfO9P9SeM0YMTHqrLKqbozlmnSyAOJO98iqNHJGSDbLVUwIB2qNfj4zFkWvoYQTqCGv xJH4XD061lLpVRE77alhUpcFRHPgxHpSqwZAGDCgBHvW5fw95FjqX/McZLv2TP9JxPyd igaEC4NHdDMd/3khzul260tZxO8Um2boaCNbNy84ND3ftoOCie7Slxl3SHvqA+EPHhlK KXKU++aTPMu6LrMMdWhPLbHyBLg0WYSQbcNLHcsa4VdJNNJTeSwBd/P/ITyUMfVP1urZ RjRq43sWvBioYj35i0gySVjs+b1NwZq41jtIQ4odCgX4AC9+oWEON+IsbjFm+K9S9ZTF RA== Received: from eur02-he1-obe.outbound.protection.outlook.com (mail-he1eur02lp2058.outbound.protection.outlook.com [104.47.5.58]) by mx08-001d1705.pphosted.com with ESMTP id 3aadmr4fra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 11 Aug 2021 15:59:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bSeLn2cpvZzuxzy8M+gHj3riYjQ9zKKw1uhCezYgLv+obuyDZ7ElkgOsV+TwnNlU9xzJHEHtHKy1+qdHObaVqzkPvS2mvwT0rjjzcrJ3plgTyaTirer6cr/SinZTHQMXVcKkcluoQUJLe8y33ecy3eZxalW3nCQF3Ybqn81ZlaV2YqT0MbLQ/b4iraiTZhTKzL0zL4Ma2cKESjHNdwjyQ8SrIwmPwmuvGC1gsLu9taXb/lf7TWbbB7nJe67LP4UlMGunWyRqKCM5pwk36PRwuJqKsd6NFtlYFAinRw+qp06ONUeeKQsWb6DgA91sMJfmLWv+eDLGKXrOALrmybv+/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KoDZOgPObL4ac4Q7Zy3/pYv78VsHsdfezBa7SIhs8xA=; b=Igt+jSZ2G59Vp0fb/KgYlUSvMcXntIz9ANzjfjqX1HThekRvsdmGohBxF1x/Cgecwy82csmJ2pKbYMPED3BTrNmrTw/Og0y/NmmcCViNkJDF1VvZrqRAebXKQRl8rGRlgQfLaPi1Oble3NWgixvYRwkbX9lc4Hda7gb/MBv/J/8id1cYuGgD9Wauz5TGnm4R3ok4eqV031kJE5R59G8l3miqJaPebzAI5noOa/jsXy4DzbfEufPT/Pufq2pwH7ZfTzMIJcCzA7Od9WksEYwfhkvpVy2ZvqqunxLOgl284syZ9ZYLOOZoEQeuT14HjL6mRPApgpVKx/oZyg8qm6eNwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Authentication-Results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=sony.com; Received: from VI1P193MB0717.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:158::21) by VI1P193MB0494.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:157::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.15; Wed, 11 Aug 2021 15:59:31 +0000 Received: from VI1P193MB0717.EURP193.PROD.OUTLOOK.COM ([fe80::c993:abef:dc9a:a7a2]) by VI1P193MB0717.EURP193.PROD.OUTLOOK.COM ([fe80::c993:abef:dc9a:a7a2%9]) with mapi id 15.20.4415.016; Wed, 11 Aug 2021 15:59:30 +0000 From: Thimo Emmerich Subject: [PATCH] df: Fixed usage of incorrect stat data when using automount To: bug-coreutils@gnu.org Message-ID: Date: Wed, 11 Aug 2021 17:59:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 Content-Type: multipart/alternative; boundary="------------14DA615DD2D97B41F185470E" Content-Language: en-GB X-ClientProxiedBy: PR0P264CA0199.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1f::19) To VI1P193MB0717.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:158::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [43.196.186.66] (157.68.5.3) by PR0P264CA0199.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Wed, 11 Aug 2021 15:59:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8d6fba61-8294-4edb-5daf-08d95ce10131 X-MS-TrafficTypeDiagnostic: VI1P193MB0494: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YFfmHVMc779kH03Ow7OZt3oYoKBLwefbACdkG4DZw0ljwfrQZJU3SbofUKN2GxS0d4Bl5ysyllhcHSU9h0puuQUXdqGaE+PK+WAEHoPI6+5vYCMQs8XjdMrh+CPKYl4gy712FdObrTVbbO6NFzSen+NPY8E9FYMq38SVZejDrgjK9xU2mNR0DGpVZvjCbuxvBZ+6vc1wmvkF+URPY1MPQdd9/TTTQoUQPx0CMyX4aqzIgf4J8pmaTPyh608gMxcGGv2VQZN/71X8gVJbLlNvTVcC47/Si/ajxLUtqJdLyF29drA0uucn2HOufNiEEAY3Hk8xG0KHRtq6uCHcf1UFt2LnKry5bXnv81iemaqyZD+9FXwqQDOmj2grXkz6qyPcXtSMflKl0iXvgP14ostUYjyJ8hxZ91wqtX/zxiibMwDhELjVid5eOsHbzY/iyaPAfOibArsvtyVb3KlMoHJUK/OaY724lz8er6A7KEXUIcLVyf6fLA9mEPorzTAjGizbNdkAO0/BZovFZ2M3pqt4RTMKjhe1K22rHJVB7fU70YnsKY84k9G7U43LfQdYPjIrPryJ2Lqc7wc+G/izOPmZB66Wv2TCuJN7dYawjSq0+xtBdciVZ02n3QNdo5zz2EJFEr6KoXO3XTXYO/RrV+LYkLVOhOKULFZX4bkrVmglwlh/SPM9+AVWSmLcFydzqTCdCpcSZIl4FSJU+zV3i4VKx6WPavKiWsfVfMssnYFlTWnL2X1POhQ42WZqugmXbDKOkgL0ZspxIGDeS9MxsRM4gCFwBfyUpjWUbJxD/VhByT6L9+8TxLs0UuaT6xL7cEBmOPiqnaxpRuYbr/SNlRntICQD4KNauZINTw1fl278xaWy1unG53bB4ba0bA0Z7HikFhhq6d9wP2uAmzN8uBKQBjt6suWcqX1+zF1uTE/P+bY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1P193MB0717.EURP193.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(396003)(39850400004)(376002)(136003)(8676002)(2906002)(5660300002)(38350700002)(38100700002)(186003)(33964004)(956004)(8936002)(6706004)(2616005)(26005)(53546011)(36756003)(31686004)(52116002)(6486002)(16576012)(478600001)(966005)(316002)(83380400001)(166002)(21615005)(44832011)(6916009)(66946007)(86362001)(66476007)(66556008)(31696002)(78286007)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Mklza2xlbTkraWRIeVhVY2crWmtkemlKbDFSSm1DRmRnTFhQb29OSGtieWtP?= =?utf-8?B?d3FQYlkycm5jdkNWN3pSV3JtS0JQSmozVzJ5bkZ6Y2ZSQkhnNVRFZjRyaFZ5?= =?utf-8?B?TjZla0xyYllMeDZMMC92VE82c3J5cHJvdzVSUXNQREN0Qk9KVXFRQTFVdHpj?= =?utf-8?B?a29CVlZPSjNKWWRYVjR2SnR3dXE1cU5ZSElrQmlkcU9RZ0JRMk8xUHh2cVQ0?= =?utf-8?B?azNsR2dBU2dHYUJBdU5UMGwrNlFCWUhJVnhwSFNyUVhTMDhlSGVTcWJ5dHhI?= =?utf-8?B?blIzOGdJdGtRZGgyRDFUQWpuV2s4cSsrWTVkT3g3QTFZL2NzWWFNcE5WVHhr?= =?utf-8?B?dHBzeTRqMENiZVlYYlppbldzbi9QY0taMHRBVEs1N3FVUFhOcHpKUk1KcDVO?= =?utf-8?B?ekdkb1NuZW1JcjYwM042MjZMMW82NU5mUmh4a21QbTc0ZWFmVGh2S0tEbTRz?= =?utf-8?B?K1BNV1RpL3Y5eVpnbUdxUG9FNFZJOGZ3dStnMzFsOWJTSy9EMDlxZlJUdnBo?= =?utf-8?B?RW14V1VPcGdiK2ZOU0FBcS8vYmNma042ZE93aTJVd0tIbW5YcFFzbnNkbkhy?= =?utf-8?B?dnUrY200RXNiQW9Qb09xcks4UFA3VitycUcrUHRsaFM2Nm9kR1l0L0JiR3cv?= =?utf-8?B?SkVGNTIwaUF1b2lWcTNpa20xVGswK1V6ZStrUVFXRk53MWFYRlljOVFyVGFG?= =?utf-8?B?UDh2VkRaMUpaYVpTWEphdm8zWXY1eHBXRGRrWlVSb3FNTXNEcC9iMERtN3o3?= =?utf-8?B?c0doTDB4UlRlZllySlROZFZxWmdLV1RiZGtENXQ2aWp2dU1xLyt1ajVhNDVm?= =?utf-8?B?RDA4YlExRHhRM0VwUE45bGlyQUh1clFERzYxUmwveUJsUE96bERsSWdvZHNH?= =?utf-8?B?SHFkTEZjc2JoNDlFRFJ5dTZvdnF3Wm5UeDY0blRwdHZGQlZhNTJEYlVkUWRv?= =?utf-8?B?MUUzTTFhdFZkTlBZdUdXbVI3TnQ4N1c4Y0hiSDdlV1VzcHRTbDBVUDBRV3d0?= =?utf-8?B?b2xFb09MQ1d6bWdHelVIdkVRNHVlNDJKQXIrV1ZDaW9wbFZsZ1FRWGRTdk8x?= =?utf-8?B?SVorZVF3T2NCUmFZcFIza1Y4b2Y2QkZneC9SbmtMbTV4cDRWekNsSVhMMDBj?= =?utf-8?B?Wi9QWXN0S09aTllIcU9DK2FGOFNkc1FFNlE1NFh1aFk1aW5VQnlsYnBsOUdW?= =?utf-8?B?QWh0djNHOGdkMnRiZ0txY004UHVJWTFwdzRVN052Mlk5NXhkSWJ1V1RqNUV3?= =?utf-8?B?eXhOUXVNcTk4cGhkZncrK3RUd1Z4UW0rcjR3MVN0QUMrU2tDRGh5aVhlbUpE?= =?utf-8?B?Qk8vaEZOeVV1V2RTZ2thU0cxNVZtYm80QVFpTXBJOFJVR1dpdGJhVDI0VGdx?= =?utf-8?B?Z0hTeXQwQ1c2ekRKZGJ2WXIwR1NIUWZZbEZwbnNDbVNUcldlS1UrT3VETElD?= =?utf-8?B?LzJDckJCaXJDd0k0S3pPaEFXdktVRWxwdFl5NG9WWGwvajdValJJaUxSKzM3?= =?utf-8?B?cC9lM25aRzA3cUxuMWNuUjNsZ0s0MkJrTlg4NThmUFVOWjRId2tpQjBwWFRL?= =?utf-8?B?b1JqenVVbllOOEdiWEJJRCtXZWJsay9qemsrMDVMZWwxVnM3cXhQeXNvc2lw?= =?utf-8?B?dDNhTjJFY2JQNkxqN3JLZ3FxcTZ3N0NKYzNtckxubWJVcVV4MXBSWThueER6?= =?utf-8?B?UU90NEhOMmxNZUhlcFhEY0dUNTRabTBuN2Rvd05ORmtYSFZsenZaeldyTzZX?= =?utf-8?Q?D1M4Hisap4H7hoanFrUpaRJFT8CcQjyVQ9X+31t?= X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d6fba61-8294-4edb-5daf-08d95ce10131 X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0717.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 15:59:30.8907 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CLlt/C/aM3dO1HYXKqy3WE8d56yhCI3a5ZZYbJpRv3hmlBGnoCOVlVkP4fjynho4STqflsp19BxMdvQuOQ5h0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P193MB0494 X-Proofpoint-ORIG-GUID: 8OMyMZn2PKRDJxGxuLFtuc7R0pe5N8MZ X-Proofpoint-GUID: 8OMyMZn2PKRDJxGxuLFtuc7R0pe5N8MZ X-Sony-Outbound-GUID: 8OMyMZn2PKRDJxGxuLFtuc7R0pe5N8MZ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-11_05:2021-08-11, 2021-08-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 clxscore=1011 impostorscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108110107 Received-SPF: pass client-ip=185.183.30.70; envelope-from=Thimo.Emmerich@sony.com; helo=mx08-001d1705.pphosted.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 11 Aug 2021 12:00:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --------------14DA615DD2D97B41F185470E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit This seems to be a regression from b04ce61958c1: "df: fix hang with fifo argument". When using df on an browsable automount map (in my case NFS mounts) df returns a screwed up information if the mount is not existing. During execution it triggers the mount via open() but it uses previously collected stat information for the output. A second run leads to the correct information due to the mount in the first run. Example: me@app07:/psg$ ls -ld psg01bu drwxr-xr-x 2 root root 0 Jul 23 17:33 psg01bu me@app07:/psg$ df -h psg01bu Filesystem      Size  Used Avail Use% Mounted on auto_psg        2.0T   80M  1.9T   1% /psg me@app07:/psg$ ls -ld psg01bu drwxrwsr-x 2 root abc 4096 May  5 11:37 psg01bu me@app07:/psg$ df -h psg01bu Filesystem               Size  Used Avail Use% Mounted on fil36:/vg1/lv06/psg01bu  2.0T   80M  1.9T   1% /psg/psg01bu This behaviour could be observed on Ubuntu 20.04's stock df command (coreutils 8.30-3ubuntu2) as well as on latest GIT master. An old CentOS 7 machine is not affected. In general the comment in df.h "stat each of the given entries to make sure any corresponding partition is automounted." is suspicious since in [1] it is explicitly stated that "Any access to this directory beyond a “stat” will (normally) cause the d_op->d_automount() dentry operation to be called.". Since the stat in [2]/df.c, line 1775 is necessary for the following fifo evaluation, it seems to be necessary to update the stat information after a successful open. Best regards,  Thimo [1]: https://www.kernel.org/doc/html/latest/filesystems/autofs.html [2]: https://github.com/coreutils/coreutils/blob/master/src/df.c#L1775 From a586ab553d9e6f463049349a8ca88d7e727804df Mon Sep 17 00:00:00 2001 From: Thimo Emmerich Date: Wed, 11 Aug 2021 17:50:22 +0200 Subject: [PATCH] df: Fixed usage of incorrect stat data when using automount This code re-runs stat() after open()ing to update possibly invalid data. Invalid data can occur in case of using df on an unmounted directory in a browsable automount map. ---  src/df.c | 16 +++++++++++-----  1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/df.c b/src/df.c index 4534935f5..a5288cb6a 100644 --- a/src/df.c +++ b/src/df.c @@ -1766,9 +1766,10 @@ main (int argc, char **argv)    if (optind < argc)      { -      /* stat each of the given entries to make sure any corresponding -         partition is automounted.  This must be done before reading the -         file system table.  */ +      /* get the stat() information for the fifo check. +         In case of a browsable automount map this stat will +         not trigger the mount. Thus the information needs +         to be updated.  */        stats = xnmalloc (argc - optind, sizeof *stats);        for (int i = optind; i < argc; ++i)          { @@ -1780,10 +1781,15 @@ main (int argc, char **argv)              }            else if (! S_ISFIFO (stats[i - optind].st_mode))              { -              /* open() is needed to automount in some cases.  */ +                /* open() each of the given entries to make sure any corresponding +                 partition is automounted.  This must be done before reading the +                 file system table.  */                int fd = open (argv[i], O_RDONLY | O_NOCTTY);                if (0 <= fd) -                close (fd); +                { +                  close (fd); +                  stat (argv[i], &stats[i - optind]); +                }              }          }      } -- 2.25.1 -- Mit freundlichen Grüßen / with kind regards Thimo Emmerich ------------------------------------------- R&D Center Europe Stuttgart Laboratory 01 Phone: +49 (0) 711 / 5858 - 282 E-mail: thimo.emmerich@eu.sony.com Sony Europe B.V., Zweigniederlassung Deutschland Stuttgart Technology Center Hedelfinger Str. 61, 70327 Stuttgart, Germany Registered at the Court of Berlin-Charlottenburg HRB 129332 B Main Establishment: Sony Europe B.V. Registered Office: The Heights, Brooklands, Weybridge, Surrey, KT13 0XW, UK Incorporated in the Netherlands No. 71682147 Directors: Hideyuki Furumi, Masaki Kurebayashi, Ricky Londema --------------14DA615DD2D97B41F185470E Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit This seems to be a regression from b04ce61958c1: "df: fix hang with fifo argument".
When using df on an browsable automount map (in my case NFS mounts) df returns a screwed up information if the mount is not existing.
During execution it triggers the mount via open() but it uses previously collected stat information for the output.
A second run leads to the correct information due to the mount in the first run.
Example:
me@app07:/psg$ ls -ld psg01bu
drwxr-xr-x 2 root root 0 Jul 23 17:33 psg01bu
me@app07:/psg$ df -h psg01bu
Filesystem      Size  Used Avail Use% Mounted on
auto_psg        2.0T   80M  1.9T   1% /psg
me@app07:/psg$ ls -ld psg01bu
drwxrwsr-x 2 root abc 4096 May  5 11:37 psg01bu
me@app07:/psg$ df -h psg01bu
Filesystem               Size  Used Avail Use% Mounted on
fil36:/vg1/lv06/psg01bu  2.0T   80M  1.9T   1% /psg/psg01bu


This behaviour could be observed on Ubuntu 20.04's stock df command (coreutils 8.30-3ubuntu2) as well as on latest GIT master. An old CentOS 7 machine is not affected.

In general the comment in df.h "stat each of the given entries to make sure any corresponding partition is automounted." is suspicious since in [1] it is explicitly stated that "Any access to this directory beyond a “stat” will (normally) cause the d_op->d_automount() dentry operation to be called.".

Since the stat in [2]/df.c, line 1775 is necessary for the following fifo evaluation, it seems to be necessary to update the stat information after a successful open.

Best regards,
 Thimo

[1]: https://www.kernel.org/doc/html/latest/filesystems/autofs.html
[2]: https://github.com/coreutils/coreutils/blob/master/src/df.c#L1775

From a586ab553d9e6f463049349a8ca88d7e727804df Mon Sep 17 00:00:00 2001
From: Thimo Emmerich <thimo.emmerich@sony.com>
Date: Wed, 11 Aug 2021 17:50:22 +0200
Subject: [PATCH] df: Fixed usage of incorrect stat data when using automount

This code re-runs stat() after open()ing to update possibly
invalid data. Invalid data can occur in case of using df on
an unmounted directory in a browsable automount map.
---
 src/df.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/df.c b/src/df.c
index 4534935f5..a5288cb6a 100644
--- a/src/df.c
+++ b/src/df.c
@@ -1766,9 +1766,10 @@ main (int argc, char **argv)
 
   if (optind < argc)
     {
-      /* stat each of the given entries to make sure any corresponding
-         partition is automounted.  This must be done before reading the
-         file system table.  */
+      /* get the stat() information for the fifo check.
+         In case of a browsable automount map this stat will
+         not trigger the mount. Thus the information needs
+         to be updated.  */
       stats = xnmalloc (argc - optind, sizeof *stats);
       for (int i = optind; i < argc; ++i)
         {
@@ -1780,10 +1781,15 @@ main (int argc, char **argv)
             }
           else if (! S_ISFIFO (stats[i - optind].st_mode))
             {
-              /* open() is needed to automount in some cases.  */
+                /* open() each of the given entries to make sure any corresponding
+                 partition is automounted.  This must be done before reading the
+                 file system table.  */
               int fd = open (argv[i], O_RDONLY | O_NOCTTY);
               if (0 <= fd)
-                close (fd);
+                {
+                  close (fd);
+                  stat (argv[i], &stats[i - optind]);
+                }
             }
         }
     }
--
2.25.1


-- 
Mit freundlichen Grüßen / with kind regards

  Thimo Emmerich

-------------------------------------------

R&D Center Europe Stuttgart Laboratory 01

Phone:    +49 (0) 711 / 5858 - 282
E-mail:   thimo.emmerich@eu.sony.com

Sony Europe B.V., Zweigniederlassung Deutschland
Stuttgart Technology Center
Hedelfinger Str. 61, 70327 Stuttgart, Germany

Registered at the Court of Berlin-Charlottenburg HRB 129332 B

Main Establishment: Sony Europe B.V.
Registered Office: The Heights, Brooklands, Weybridge, Surrey, KT13 0XW, UK
Incorporated in the Netherlands No. 71682147
Directors: Hideyuki Furumi, Masaki Kurebayashi, Ricky Londema
--------------14DA615DD2D97B41F185470E-- ------------=_1628706301-10953-1-- From unknown Sun Jul 27 09:36:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50012: [PATCH] df: Fixed usage of incorrect stat data when using automount Resent-From: Thimo Emmerich Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 12 Aug 2021 15:02:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50012 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Paul Eggert Cc: 50012-done@debbugs.gnu.org Received: via spool by 50012-done@debbugs.gnu.org id=D50012.162878048914073 (code D ref 50012); Thu, 12 Aug 2021 15:02:04 +0000 Received: (at 50012-done) by debbugs.gnu.org; 12 Aug 2021 15:01:29 +0000 Received: from localhost ([127.0.0.1]:39632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mECD2-0003dY-8R for submit@debbugs.gnu.org; Thu, 12 Aug 2021 11:01:29 -0400 Received: from mx07-001d1705.pphosted.com ([185.132.183.11]:52196) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mE4xB-00048s-DD for 50012-done@debbugs.gnu.org; Thu, 12 Aug 2021 03:16:38 -0400 Received: from pps.filterd (m0209326.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17C7GSYx009346; Thu, 12 Aug 2021 07:16:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=S1; bh=2VtMwoH8gLOzJ1cxD/TacaGuoGav46Hl+AVaZBOvNHk=; b=P7VB0SU6wxTzynq0AXA1/g1sqOaLxTc4bLIvat044S/WhegEE9RA4tuyapjIuBNK0FUR NHXJT0Px7iHMy01AwmGsamnfV9m0o0t4r/usP15GSVriZd7C6iCmh5X6g3K3ocMY4qqL SmI1vpdsIHOw+7gDBkOzbK5cmQ1tro7K91RjLa4FCMWD9GqzJdPKG8winls2NwFq49DO IlTGu4gbM8pd9JIEEVERCRq0XZI7U5pWjGuRvgckEEy4c4k1YAaBh+5XtoJ1e/EktbVP qxpbznXxc9LpTT5Jroaa0dwY++6X9KvYc1B+V6KGKdDPF2gD/HD9/mbBFQ5K8A+3f7Z5 iA== Received: from eur05-am6-obe.outbound.protection.outlook.com (mail-am6eur05lp2112.outbound.protection.outlook.com [104.47.18.112]) by mx08-001d1705.pphosted.com with ESMTP id 3ac6e40sps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Aug 2021 07:16:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xq+vQ/fAy0K9PS3I9N61tNUxJPLyYFmKUX/faruTeJM4C5FQDPMPOi/S1YVt0ITSQOEOFUjfUu9wVnlF3ddHI3KmJgL2Qw663g0qOh7gKb93lnVeSjI0B5hlLVXeKBW2g22ePlXGbZVxzg9S0RVlI2stuePaV/MBYtqf4/k7J9Q0Jq/01GRVbmL4WT/jZodCEssj3OMGXNixi46I8VtbaNH9omj085gt/X524RsbmFmbyzS+WAIKiFS6nL+SMJNLnNzJ97TMc/lhxL9EbtXbqr0qBrAcg3yg8K5qoF7Q1wsFbIxUHXTX1NiEyBa12CxGz05r5VOzpefu4sxRnEnP3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2VtMwoH8gLOzJ1cxD/TacaGuoGav46Hl+AVaZBOvNHk=; b=UjKe9+G3nGTI7bl/typEGN0zXpeEDhqmuTuSWEsztCzWRA4AwYu7X/RdK4oYSkoaf8hfOCPncpBHDdOZs7wAidpa5q4FZ7uIAZ2f/NaNuMeYyqJZZ8Ey8oiv1nJOBut8JhK/gj5eNpD9lH/PQ07eusi/FzC7ULUrE62GqrrJe9Vcs6mx9v57G0ZGE0L8EMX+BcHxemd6wiKrHeW3wGdz7/aa3U8Q9JsTgHBHYUW7uOvJo0H9rrap6wN2fdBlsPNWEwH/MLVgfC40Inl+rYujtzlwxcN6lLHP+lL070HsfJLpv/ec3Q5PgnP3GVD+ZilIhH2WeFk/pbVA31C0Z/NukA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Authentication-Results: debbugs.gnu.org; dkim=none (message not signed) header.d=none;debbugs.gnu.org; dmarc=none action=none header.from=sony.com; Received: from VI1P193MB0717.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:158::21) by VI1P193MB0109.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:c5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16; Thu, 12 Aug 2021 07:16:25 +0000 Received: from VI1P193MB0717.EURP193.PROD.OUTLOOK.COM ([fe80::c993:abef:dc9a:a7a2]) by VI1P193MB0717.EURP193.PROD.OUTLOOK.COM ([fe80::c993:abef:dc9a:a7a2%9]) with mapi id 15.20.4415.016; Thu, 12 Aug 2021 07:16:25 +0000 References: <413d2c76-8868-8605-2416-cbc11c286de6@cs.ucla.edu> From: Thimo Emmerich Message-ID: <0b1fe834-f8ca-3da7-308b-d7082fdc79b5@sony.com> Date: Thu, 12 Aug 2021 09:16:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 In-Reply-To: <413d2c76-8868-8605-2416-cbc11c286de6@cs.ucla.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-ClientProxiedBy: AM0P190CA0011.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::21) To VI1P193MB0717.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:158::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [43.196.186.66] (157.68.5.3) by AM0P190CA0011.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13 via Frontend Transport; Thu, 12 Aug 2021 07:16:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0451b6f7-dde8-4f59-8f97-08d95d61185e X-MS-TrafficTypeDiagnostic: VI1P193MB0109: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ijmCj8eC65/KfB4yPOqRsqNtI0qg5wXAqsPLpVlGgD319Qe2sLLLv80PtfXqpQIPwEJhS/2eMs4oUO09QevImysZNozf6fEgWaWWUYsgvoEB3i3wepODYZnIIuow1hMR2aWg4ZXYFen6YvfNMXU+QRtR5QPjy/VKN63IPBzYKyJn48jBR4PrjR1nv29MVJXw9bSschjumUzF91DwKKmJzw5wS0T/zRmLE60zJEZHPG4S+G+xkORnO0Iy7BWPSEcr6DL4L86H282l4ihfvWHntPMV5AVXgSM6VICOp3ztwODJ0xcz8tIHee/lFsuchAnFlqlrXMhQJFBPdWK2A8x67x/2Bn/if3IbmxWoVJeGCteGDCsc8WXHrcHgEdKdOOwGT0+VCY47qXXnI4Y7fNVYhiXxjSbyoGqRoaz2N/sTqVGhG1fdlC2kSJB+9AJut0fxZMqfFtIByBaFkWSSUAAoQT8eqSThB+2xnkm2QlYFJ2ox2MNw9rfChT5WiTRNaYa6O/XgPmpHoVZ4hDiW6GuOe7rgM29zEwk5MghJG4cTh/00lIz3UJgX3Nxxt2nXUHUPh929ici27aKGqjBpC1GhSHPbnfei0A1U313cyO3LsOnIL6ovZPE6ojQVB5AWivok3L5/KPoZsUdQY9eTWfZXmKFLaY60O/Iyn8G6wfK17R//rcoOAfFKxjyxoOgFlGnqiJh7C4AVI56i9ZJby5VelrrV+gpJsdzTOtk0LqjLEEvliQLm7NzA8LF+BL1M7gw5qZaPblEoMwz6rDHaTgouIM9b3LiuzWYF+FnM5VnW9NU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1P193MB0717.EURP193.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(136003)(346002)(396003)(366004)(376002)(39850400004)(16576012)(316002)(31686004)(52116002)(956004)(2616005)(478600001)(26005)(4326008)(53546011)(8676002)(36756003)(186003)(8936002)(83380400001)(31696002)(44832011)(6486002)(4744005)(86362001)(38350700002)(38100700002)(2906002)(66556008)(66946007)(66476007)(5660300002)(6706004)(6916009)(78286007)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TkUC0EV66/XwluOorM1p/11qfOIV3scqb1LaD+EdIpgp/iHlXVtpMjIXd66+S9hqrU7OgzHflZqg+yRytG4UWJ+tPpYUNwJqc1HhU1PU4vGmylV0IjLf3HIyaK12YJYIGZcLfrAg7gXOncRNGrDBKTeOUu0EFCFxwRjnfJ37LUpNKwGST7w3TMRJ7irggmly5PLRlonFCJYwgSttO7B8y9shOAUmhQ7NpvZxT1we6pQmo1dr2pOGXhUWl3GiN71lKGDKdtQSegSEael2tNWs1jd7lErmOmBY/tUyyBR8n4fFy9AvmUPq14aRf8Nr4WevMjjjNxP/x8m4gsP5SR+ddWk2pIpF7EDQ3yWcSfpkQ3N/iMaHopEZ0SVLBY5zUIMt2ntEvYmMrchBVNKypIuo/VArJxePrvgibfNEnwcY/CZ2/0esxjCJDNC3OJgLkoYzza6vSBejQwXTJWPws5+KKHCTJBcD6+Z6q8i1wRdnnAJ7iaQtzsAtCP4PWQeof4sOLbe1YYrbOi/tJd/BU67VCugCwP9+H6DCs0eYL9/XDJ0GZQfbF/9vJE8YueOZvRelP/3I7DIraQTGGYcdp023ZWffVwEXkuadoSLIP1syTOMtr10vpBmzs3AvhdF4gWswG3QL3B4Zxd7GrEP4/EwY050MuvzsB/B+4bugUslTV73u3ttzkxHmC0CQwGl+bs2JZbF3LnVJvUCH9O4dPl5foEQxh/bOOKSjKloB+CgVPWo+EUb6tNwcMSaQPaLMLkoMLWsrWixBi+0cD6f7ZWF3J+80tFUYFst68JpnX0SOMMI+fAAECYQ5BxB3CcOjlvY8If7ZkZwYRk54Ol+DY8pUkD6GxSG0XCTQF4JaSvLBv/ENh6JILpHbQ4Ypa+80XY0Mm5LuMkaNmxILor6GGRnw8UdQdy344k2JNmAceuM5A58327shESMr7HKJO4RGRoLptxUEvCm1thFlp/imgqALQmtjuIUzewn4VwYcwrA89Rl3EuOgzZvfYqcWC6kPV9+taukQ6TrASFThF2Mv2mt1IevInncM4pzdBbegn/Psr1ym8CA8mMrX3neV7y4bqM0vcwuf2c+gEU/TyNNGUIL30krlqd7ho5VCEVz2za6B0AreXxfB5FGoNNRs3JzHibFKwCu0SSB+Kw+Sdj0HSoSpwCCxqjuJYp4AfSrdQ4Qq24ImMZJOrzBl/B2dE0AKz9cSVYtLrDsnKFjPPr/4DoNn1sS6YJ225EpG4ouFycsM+0GBJ7hqVaDNBCqQlAU2hNzQxJatTdKxJHHEnlF7dq+/XwQs7NYmaQY0MivYhaPDUnzBxOqSDg1wZ0KAttG+aGjc X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0451b6f7-dde8-4f59-8f97-08d95d61185e X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0717.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2021 07:16:25.4415 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9diWuiBTHFgdffTdAnBC3bK0xgVuQxl4JOp14NraNPPyD5V+L1rbvpxjowk/i/um5CQKhQjp6H4SSrs5yuCYeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P193MB0109 X-Proofpoint-ORIG-GUID: YLTorFr0Sek6kVPdKf44V13V61Zoy4qa X-Proofpoint-GUID: YLTorFr0Sek6kVPdKf44V13V61Zoy4qa X-Sony-Outbound-GUID: YLTorFr0Sek6kVPdKf44V13V61Zoy4qa X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-12_02:2021-08-11, 2021-08-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 clxscore=1011 impostorscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108120047 X-Spam-Score: -0.8 (/) X-Mailman-Approved-At: Thu, 12 Aug 2021 11:01:27 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) Thank you for taking care. Your fix seems more elaborated and works for me. On 11.08.21 20:24, Paul Eggert wrote: > On 8/11/21 8:59 AM, Thimo Emmerich wrote: > >> Since the stat in [2]/df.c, line 1775 is necessary for the following >> fifo evaluation, it seems to be necessary to update the stat >> information after a successful open. > > Thanks for reporting the bug. I installed the attached. It differs a > bit from what you proposed in that it prefers fstat to stat, as fstat > should be a bit faster and should avoid some unlikely races (there are > many more races, but one fix at a time).