X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=K8l4WR388ZchfngI zv0wp9FW97+oU5hc7b0xi/29Zg4gvSxtyBKSV/VR9WgVlTEZ9q5/+AauaaRUoaaV LxEDDGO5gbwt7sOnigsGgIaehoQK+LwvLOUb9kYsUdc6S1KYQEEF/b4kVrPYpqE5 fXhPK175Wq1dnPKA3unqQlHte/w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=KnsC2f1/XBPwNZLvNeUxLb EBdy8=; b=OZEwpL+uXp+TmjO/nRN4imDjMqfbKL8K6nfhEOhH3gUwsioBYk/sif 90iP3Z2uhIRI4KqdzTNoH+P60VMS32WpkL5dva9oI4oPpO3Vwixx7MnvK3SZyQwY KkSEQJznwKMzs4euIH8ieRkavI+9pQwJp/syhdBIeXg0CziBsvZPg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=cook, Cook, platforms X-HELO: mout.kundenserver.de Subject: Re: deleted current directory behaviour To: cygwin AT cygwin DOT com References: <20180116041301 DOT trp2qwc2qexos7kp AT mars DOT tony DOT develop-help DOT com> From: Thomas Wolff Message-ID: Date: Tue, 16 Jan 2018 08:55:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180116041301.trp2qwc2qexos7kp@mars.tony.develop-help.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-UI-Out-Filterresults: notjunk:1;V01:K0:0Vo3llh71Uc=:hGa11SJ8U/NALxBSWb3TDr mrmHiXj9Fyw45NLk5e7TpdrgAr0KGZN8LMJcFjJ9N7tY1CwjpXR31a6VdjgQ3CL/D1Mk/Ub7t LvSl2KpWGy1bLmFM4V9XSr5YWKuhoDevIdDugQczz/7zyP3DOJ7SzCGaV8JPzLIMHG3qMJLqQ gi/EBLf8HH2+nycWnkSlv25S0VevgsyiM98/nicD82tFa8HIKH+Kf9erJNObDm25RZPg9oGhX KHa7/cAgSoOUkpUafDvd7SQdu5AXNiUVx344v5x/p/gJhWNJI48RMcBXgTBMDixaoTRNyLG9D gRirFWwZxDKUKCQIZpcTMeaZpK9YXA6CT0tIxENRcK709DUt5kP0GgW+x3UCFS9yS0bwKvEaA WZS3sSHNCMleczk+9+W/foUB/SlTysoNrbnZuM+xGPERtSzQ3adm8FmNKXfFgILEBpVtEu95W 5l4v+kvK3CIGKVI2+pm0lmBkJDZXbMlOpycY6xfVFCrBJ8Q1Fd2hD7gALRuL96tHRE9rNZ7UQ barJlVz1qYTljTQ4PpHgay1dr0d7mCsjkmpDQdjvCjHY3i5ou+BIpIL63tOp39xk6Y31SEeRa caJv8vZEEkvxnpNoSkUM9kQSow2ebBfI6XGOK5fzOkdmHjwKwppOyxwwCIMVx4WLe6Ysom9FV st3bS64MQq+/JTH4xvG/MxOrWzwi/z8vNN2/Gaqo3HEdrbquDktUySajFED8JPCfOuvhCPjrY JQQDXFw/hqhxasjBc6SYLIaGOZMjjc4XBigVB2p0/C4pIcDd2nrMiEOUR1Q= X-IsSubscribed: yes Am 16.01.2018 um 05:13 schrieb Tony Cook: > Currently cygwin emulates* Linux (and most other POSIXish systems that > I'm aware of) by allowing the current directory to be removed: > > tony AT saturn ~/dev/perl/git > $ mkdir foo > > tony AT saturn ~/dev/perl/git > $ cd foo > > tony AT saturn ~/dev/perl/git/foo > $ rmdir ~/dev/perl/git/foo > > but is inconsistent after that: > > tony AT saturn ~/dev/perl/git/foo > $ pwd > /home/tony/dev/perl/git/foo > > tony AT saturn ~/dev/perl/git/foo > $ cd ~/dev/perl/git/foo > bash: cd: /home/tony/dev/perl/git/foo: No such file or directory > > tony AT saturn ~/dev/perl/git/foo > $ cd ~/dev/perl/git > > tony AT saturn ~/dev/perl/git > $ ls foo > ls: cannot access 'foo': No such file or directory > > The pwd isn't (only) the shell caching the current directory: > > tony AT saturn ~/dev/perl/git > $ cat 132648.c > #include > #include > #include > #include > > int main(void) { > char buf[1000]; /* keeping this simple */ > if (mkdir("foo", 0700) < 0) { > perror("mkdir"); > return 1; > } > if (chdir("foo") < 0) { > perror("chdir"); > return 1; > } > if (rmdir("../foo") < 0) { > perror("rmdir"); > return 1; > } > > if (!getcwd(buf, sizeof(buf))) { > perror("getcwd"); > return 1; > } > puts(buf); > > return 0; > } > > tony AT saturn ~/dev/perl/git > $ cc -o132648.exe 132648.c > > tony AT saturn ~/dev/perl/git > $ ./132648 > /home/tony/dev/perl/git/foo > > On Linux that program outputs: > > tony AT mars:.../newlib/git$ ./132648 > getcwd: No such file or directory > > Is that inconsistency with other platforms intentional? > > If it isn't, are there any plans to make it consistent with > Linux/other POSIX-like systems? The shell-internal pwd just echos $PWD, even if the directory does not exist anymore; this is consistent with Linux. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple