From unknown Mon Jun 16 23:56:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#60591 <60591@debbugs.gnu.org> To: bug#60591 <60591@debbugs.gnu.org> Subject: Status: `realpath` behaves differently when the target directory/file does not exist on Mac M1 Reply-To: bug#60591 <60591@debbugs.gnu.org> Date: Tue, 17 Jun 2025 06:56:13 +0000 retitle 60591 `realpath` behaves differently when the target directory/file= does not exist on Mac M1 reassign 60591 coreutils submitter 60591 Tao Zhou severity 60591 normal tag 60591 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 06 00:23:46 2023 Received: (at submit) by debbugs.gnu.org; 6 Jan 2023 05:23:46 +0000 Received: from localhost ([127.0.0.1]:53489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDfCa-0008Rz-2J for submit@debbugs.gnu.org; Fri, 06 Jan 2023 00:23:46 -0500 Received: from lists.gnu.org ([209.51.188.17]:37654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDYxb-000699-KX for submit@debbugs.gnu.org; Thu, 05 Jan 2023 17:43:44 -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 1pDYxX-0000Gp-7d for bug-coreutils@gnu.org; Thu, 05 Jan 2023 17:43:41 -0500 Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDYxV-0003XV-GN for bug-coreutils@gnu.org; Thu, 05 Jan 2023 17:43:38 -0500 Received: by mail-vs1-xe35.google.com with SMTP id 3so39620824vsq.7 for ; Thu, 05 Jan 2023 14:43:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=jwD7ZmB2vqSjOwIjX7JTh1azJI+0+BG39gGCof1VzT8=; b=EGDEWQ5EnxFy1CNifqOWBX1q61wSVCdiTIOKgNgHyLZxwraaMrz6NmAFAVGYENnu9z BDVSdnLmCqPMehwA4QoeptDb0a0vqiBp3+vE2UK5POLfrXyTrUUPRKEJw0dwPuZsBe3j QtZcUIhxhpqKKs7QUDji2h2CAPv0w30dwoeM/2DsG6jUy6iAzSurdTJ8IyF+e9g6O7Yx grgmZmAqQp8cl3wPB/iOKJWL07g/DtFQQ+Lkq0EsOE/ruiSEdoaE0UVtFdoCDheFKVVo VxWJnfuy/9D04JTDuQLVE/UASEMfUVpKLp22fkAj982CjQzEIjWDdsnmrGDs0sxQGKuH C0/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jwD7ZmB2vqSjOwIjX7JTh1azJI+0+BG39gGCof1VzT8=; b=UIjOkhTGh1ntPs6E3W4h8W0y+zu/4bv7VmvDUimPmKh3p717jL0wxm/3cd95f/F4OM LiNUtFkEYb42InY946c4gmkCtrgKDJAzkSMXs8VkofwKNB191tMCZrFqcaQ9H2Q+VIWB 3eYm7sWAyUELNp3h0fM48hmE/ae6Jw8j7urOYqphvZwl6Wnd8zO7KuhOKRGTk5lN27oi aIAOg8UbvZpPISLgT+i/H/bd0R3m1wFb46xV9JUQGnesmyIQS0VAPgrksKc6l8qO+BGX nm5qOta+lZl4GwD8kI4O+8VnY9Q/tv6/cJT70p0bOwfYM6Xc+eR+CKkStcJuiUnRcz+l n9DA== X-Gm-Message-State: AFqh2krlXJgbY72yMyf47PM7Ua04o9zy4V/hKON2DeAag68TxXh01gjJ KWQuXFsU8tFrxRmbvG3KuEgbrPoX/4eHSam4/mJSb9FBz1J3Pg== X-Google-Smtp-Source: AMrXdXtcAHhOYtkMbEpagKK08JJIgQgAKj74xZF/CBvAOO0YnukF04crye4XlHU141HlfXT+94gouFv97h9zzBqBHMM= X-Received: by 2002:a67:f710:0:b0:3ce:9cdf:9f77 with SMTP id m16-20020a67f710000000b003ce9cdf9f77mr1836092vso.71.1672958615357; Thu, 05 Jan 2023 14:43:35 -0800 (PST) MIME-Version: 1.0 From: Tao Zhou Date: Thu, 5 Jan 2023 14:42:59 -0800 Message-ID: Subject: `realpath` behaves differently when the target directory/file does not exist on Mac M1 To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary="000000000000fe0fab05f18c074b" Received-SPF: pass client-ip=2607:f8b0:4864:20::e35; envelope-from=iamzhoutao92@gmail.com; helo=mail-vs1-xe35.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 06 Jan 2023 00:23:35 -0500 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.1 (--) --000000000000fe0fab05f18c074b Content-Type: text/plain; charset="UTF-8" Hi I recently noticed something weird with the `realpath` on my Mac Pro M1. When I try to call `realpath` on a directory/file that does not exist, it throws `No such file or directory` error, compared to another regular Linux machine, the `realpath` there will just return a valid path, unless it's a nested structure and parent does not exist. Example as: ``` $ pwd / $ ls a $ realpath b realpath: b: No such file or directory // from the mac pro M1 /b // from other linux machines $ realpath b/c realpath: b/c: No such file or directory // from both mac pro M1 and other linux machines ``` The `uname -a` of my mac pro M1: `22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64` Best Tao --000000000000fe0fab05f18c074b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi I recently noticed something weird with the `realpath` = on my Mac Pro M1.

When I try to call `realpath` on a dir= ectory/file that does not exist, it throws `No such file or directory` erro= r, compared to another regular Linux machine, the `realpath` there will jus= t return a valid path, unless it's a nested structure and parent does n= ot exist.

Example as:=C2=A0

```
$ pwd
/
$ ls=C2=A0
a
$ realpath b
realpath: b: No such file or directory=C2=A0 // fro= m the mac pro M1
/b // from other linux machines
$ = realpath b/c
realpath: b/c: No such file or directory // from bot= h mac pro M1 and other linux machines
```

<= div>The `uname -a` of my mac pro M1: `22.2.0 Darwin Kernel Version 22.2.0: = Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm6= 4`

Best
Tao
--000000000000fe0fab05f18c074b-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 06 10:00:39 2023 Received: (at 60591) by debbugs.gnu.org; 6 Jan 2023 15:00:39 +0000 Received: from localhost ([127.0.0.1]:55614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDoD0-0005kG-Vr for submit@debbugs.gnu.org; Fri, 06 Jan 2023 10:00:39 -0500 Received: from mail-wm1-f47.google.com ([209.85.128.47]:35524) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDoCz-0005k0-3n; Fri, 06 Jan 2023 10:00:37 -0500 Received: by mail-wm1-f47.google.com with SMTP id m8-20020a05600c3b0800b003d96f801c48so3736921wms.0; Fri, 06 Jan 2023 07:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=a3V+mDcm1tIVAVPSKg9B44dB1QHF4kWYGrckQ+NbA2k=; b=JT9xfx3gVK5XAgSzq9jB+zpNLU0MHjOWbERkl2Z2N+lsBBpKcAzgF2PPa2MVjHOTSE roqGv7QSOdNexzWzleZ9HDnD2mpDjZe1m0gnvcUHVRL/EhzoLz0fHtvsi0GPXyxSVU62 SuJJ9kmvc0mGqW/4lQeoY51mLbCKfvtQZusQ791J84ZKIBSfN08xIqrzKMHvPcAVK3D1 KbDoWSw+aIZPJ0aMcsJVGea4h3+u01rbS1FHXKyzw4NmnMdV36ElsvGzAocLlGiJ4U/Q /+0G5+hB0agHO9LylEtX3QBXE8Z2rBziGlarArLWBAGoJaZBlUEGO9etTfVzlOQRnOg9 TuRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a3V+mDcm1tIVAVPSKg9B44dB1QHF4kWYGrckQ+NbA2k=; b=Jz/cGt4hVJ1vsrsdpkg6LXRtBYW1x6ge8107KWeOlIYHFu97wuHXc5Btn3xyXfZsQe bHga2y3dCItceVIcMurLaTz3E3MNCqG4V3cPrq0KBOrIRTPKVgfuIsoqbSoqOv5SxfzY eGvgdFG0Ow3peD80BtZ1DpJXMRb44z20Riv4qXMKdt4vy0AQbhacBh1qzYEl6Se1pSJ1 4fT5EKsf9NijuYOlUBcZxu+16cwXbiA1c5lIi4tASVePshM7rzm3xteFszzUM4kPq+Yd gjwN2A0Ao3qLECA9hydPfzErWXt9ti0O3ELsxgScdTCOgxCuF8enquLCJ2hRV86brvux m2aw== X-Gm-Message-State: AFqh2ko4ndzp9W35z/6Iq1LvRR4+fWlScx038dpbDDgWTR3/f9lcxoL9 AgkDfVPFSOGrSTiNVKt4EdE= X-Google-Smtp-Source: AMrXdXuvUA1Eze2miYfO9CxlyFmV8sHyMS/4yLV/i2xaTnrMDtrCu4vMcDKMTdd6KE0nCg1T8V09cg== X-Received: by 2002:a05:600c:1f11:b0:3d0:57ea:319c with SMTP id bd17-20020a05600c1f1100b003d057ea319cmr39536876wmb.13.1673017231308; Fri, 06 Jan 2023 07:00:31 -0800 (PST) Received: from [192.168.1.9] (95-44-90-175-dynamic.agg2.lod.rsl-rtd.eircom.net. [95.44.90.175]) by smtp.googlemail.com with ESMTPSA id r16-20020a05600c35d000b003d2157627a8sm6982236wmq.47.2023.01.06.07.00.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Jan 2023 07:00:30 -0800 (PST) Message-ID: Date: Fri, 6 Jan 2023 15:00:29 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.0 Subject: Re: bug#60591: `realpath` behaves differently when the target directory/file does not exist on Mac M1 Content-Language: en-US To: Tao Zhou , 60591@debbugs.gnu.org References: From: =?UTF-8?Q?P=c3=a1draig_Brady?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 60591 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.9 (-) tag 60591 notabug close 60591 stop On 05/01/2023 22:42, Tao Zhou wrote: > Hi I recently noticed something weird with the `realpath` on my Mac Pro M1. > > When I try to call `realpath` on a directory/file that does not exist, it > throws `No such file or directory` error, compared to another regular Linux > machine, the `realpath` there will just return a valid path, unless it's a > nested structure and parent does not exist. > > Example as: > > ``` > $ pwd > / > $ ls > a > $ realpath b > realpath: b: No such file or directory // from the mac pro M1 > /b // from other linux machines > $ realpath b/c > realpath: b/c: No such file or directory // from both mac pro M1 and other > linux machines > ``` > > The `uname -a` of my mac pro M1: `22.2.0 Darwin Kernel Version 22.2.0: Fri > Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64` I presume you're using the macOS realpath(1) here, which seems to be a simple wrapper around realpath(2), and so will just give that error for non existent files. Whereas the coreutils realpath(1) provides more functionality. Specifically: "By default, all but the last component of the specified files must exist". To change change and get the macos default behavior you could use the -e option. Another option is to `brew install coreutils` on your mac and use greadlink instead. cheers, Pádraig From unknown Mon Jun 16 23:56:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 04 Feb 2023 12:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator