From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32189 invoked from network); 31 Dec 2021 00:44:15 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 31 Dec 2021 00:44:15 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 9673A9D03E; Fri, 31 Dec 2021 10:44:10 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 26A699D004; Fri, 31 Dec 2021 10:43:46 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=iitbombay-org.20210112.gappssmtp.com header.i=@iitbombay-org.20210112.gappssmtp.com header.b="CZG2jutZ"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 056C19D004; Fri, 31 Dec 2021 10:43:42 +1000 (AEST) Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) by minnie.tuhs.org (Postfix) with ESMTPS id D40709D002 for ; Fri, 31 Dec 2021 10:43:39 +1000 (AEST) Received: by mail-ot1-f43.google.com with SMTP id v22-20020a9d4e96000000b005799790cf0bso34105278otk.5 for ; Thu, 30 Dec 2021 16:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iitbombay-org.20210112.gappssmtp.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=aTW1Zh+nct/ktBCLDDjyKlxL4f/OvJH4KkSSX9qHe0M=; b=CZG2jutZCtImijENMadss8Ypkqi2TeccZwZSnJQURtzxju5ocr2n1ZHN1fL9KCZagq c0VNa2tZ6hc8bO7KGHSAsq4jIkrpEDd3X5TMSRpasFjEbrDMhaRolFD8eNAEWoXhcvyU fvt4F5J2U1BHtzojfKG77Htkzy4KxBdc5/3jKQBo8kZc1kfXZV3l7wOH/V5TIJd4u3fD ouq7ROzcYoN3Uv4oRgS/pCAumtIClCPFo85j3mFM1/cYWbKKr1kFJDa5C5hEcJBtW4kg cY5n3MHVxHJ1KC8jmsHV4Sw43yuLuQ0CrGCamQe4+G+IE2LBrfYcpkkNJz4RQh4lMBlh 7VFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=aTW1Zh+nct/ktBCLDDjyKlxL4f/OvJH4KkSSX9qHe0M=; b=y/TZQnrtIbzsCAn0+dRYtmR1WflT13iN2AAV1Fpr8zReTyTZMBQkvr92RNRRvSxpf2 6lpMVAeQ4+7yT8zfBFiYxZphM0fgA/0xasZ5AHIjbzWysJDJ2yjr8LJBwo1wmHQ4lvAH ptkeinTIMokGV1xbJveUtJa2OWniFJ8Lp61sw9k7rXyhlLoimu7UCeuPqx1bm6VflqLh j0l4RTAiJidg8WEWvPh4xUa+UBoHxrWC6AuOdo2h2ou7cz1OjQgVFbsczrLwzdvSExXX XJFlk7Ld1AeLl5MfakQGVU8nzVyjlkJSnneCkTr3EEoRDSZUp2mHybKt9BUE+Cg151cu 1oCA== X-Gm-Message-State: AOAM531NVrnrEqMlAuy3UhyOO60x0/xZBovsdfq/XQGhkbL+/+AvDI9y E2xb2XVsdZFrqJNysgQRDR2WUPs5CpZqgw== X-Google-Smtp-Source: ABdhPJywlKcKJYLHJx32Ly4m1Ps0pXTSvQnh256bk7dEe4Vr9XWVGdXkka8k/Hl5Be5dpD0qjnEICA== X-Received: by 2002:a9d:6855:: with SMTP id c21mr24712981oto.357.1640911419074; Thu, 30 Dec 2021 16:43:39 -0800 (PST) Received: from smtpclient.apple (107-215-223-229.lightspeed.sntcca.sbcglobal.net. [107.215.223.229]) by smtp.gmail.com with ESMTPSA id i28sm5024718otf.12.2021.12.30.16.43.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Dec 2021 16:43:38 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) From: Bakul Shah In-Reply-To: Date: Thu, 30 Dec 2021 16:43:37 -0800 Content-Transfer-Encoding: 7bit Message-Id: <99D8FDF5-7B60-43CA-AAAD-974056644668@iitbombay.org> References: <20211230034512.B9B3718C08E@mercury.lcs.mit.edu> To: Dan Cross X-Mailer: Apple Mail (2.3693.40.0.1.81) Subject: Re: [TUHS] moving directories in svr2 X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list , Noel Chiappa Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On Dec 30, 2021, at 2:31 PM, Dan Cross wrote: > > On Thu, Dec 30, 2021 at 11:41 AM Theodore Ts'o wrote: >> >> The other problem with storing the path as a string is that if >> higher-level directories get renamed, the path would become >> invalidated. If you store the cwd as "/foo/bar/baz/quux", and someone >> renames "/foo/bar" to "/foo/sadness" the cwd-stored-as-a-string would >> become invalidated. > > Why? Presumably as you traversed the filesystem, you'd cache, (path > component, inode) pairs and keep a ref on the inode. For any given > file, including $CWD, you'd know it's pathname from the root as you > accessed it, but if it got renamed, it wouldn't matter because you'd > have cached a reference to the inode. Without the ".." entry you can't map a dir inode back to a path. Note that something similar can happen even today: $ mkdir ~/a; cd ~/a; rm -rf ~/a; cd .. cd: no such file or directory: .. $ mkdir -p ~/a/b; ln -s ~/a/b b; cd b; mv ~/a/b ~/a/c; cd ../b ls: ../b: No such file or directory You can't protect the user from every such case. Storing a path instead of the cwd inode simply changes the symptoms.