GNU nano - Bugs: bug #62244, when the working dir is gone, a...
You are not allowed to post comments on this tracker with your current authentication level.
bug #62244: when the working dir is gone, a different file than the intended one can be opened
Submitter: | Benno Schulenberg <bens> | ||
Submitted: | Fri 01 Apr 2022 09:54:29 AM UTC | ||
Severity: | 3 - Normal | Status: | Fixed |
Assigned to: | bens | Open/Closed: | Closed |
Jump to the original submission
Fri 29 Apr 2022 07:35:09 AM UTC, comment #6: |
Benno Schulenberg <bens> |
Tue 05 Apr 2022 02:29:09 PM UTC, comment #5: The warning about a non-existent working directory has been added in the subsequent commit, 940b5eaa. |
Benno Schulenberg <bens> |
Mon 04 Apr 2022 10:54:36 AM UTC, comment #4: Fixed in git, commit fdd946c0, by using realpath(). |
Benno Schulenberg <bens> |
Mon 04 Apr 2022 10:51:37 AM UTC, comment #3: A variant of the problem can be seen when the working directory disappears while nano has already opened a file in this directory. Do for example:
Then, in a different terminal, remove the 'folder' directory.
|
Benno Schulenberg <bens> |
Mon 04 Apr 2022 10:37:06 AM UTC, comment #2: Bug was introduced sixteen years ago, by commit 85e35e67, as a reponse to this report from Mike Frysinger: https://lists.gnu.org/archive/html/nano-devel/2006-07/msg00000.html. |
Benno Schulenberg <bens> |
Fri 01 Apr 2022 03:09:51 PM UTC, comment #1: The problem is that, when the working directory has disappeared, get_full_path() will silently change the current directory to the first higher directory that still does exist. This is wrong, of course, but nano has done this since about forever. That no one complained is probably because a disappearing working directory almost never happens, and when it does happen, nano saves the current buffer in a parent dir, which is kind of convenient, even when incorrect.
|
Benno Schulenberg <bens> |
Fri 01 Apr 2022 09:54:29 AM UTC, original submission:
When the current working directory has somehow disappeared, trying to open a file that was located in this directory (or in a parental directory) will lead nano to open a different file instead.
See that nano has opened the 'seeme' file in the parent directory instead of a file in the 'folder' directory. This is wrong. Some other editors (pico, joe, vim) will notice the absence of 'seeme' in the working directory and will simply open a new file -- an empty buffer -- and will report a problem when trying to save this buffer. Editor 'fte' will crash when trying to open 'seeme', and 'lpe' will lock when trying to save the new buffer. Editor 'ne' will report that it cannot open the file, and will report the same when trying to save the buffer. The nicest is 'dte': it says that there is an error opening 'seeme': "Directory does not exist". Nano should do something similar. But at least it should not open the wrong file.
See that nano says "New File". This is wrong: it should have opened the file in the parent dir of 'folder'.
|
Benno Schulenberg <bens> |
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 5 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2022-04-29 | bens | Open/Closed | Open | Closed | |
2022-04-04 | bens | Status | In Progress | Fixed | |
2022-04-01 | bens | Attached File | - | Added 0001-tweaks-make-use-of-realpath-in-our-get_full_path-fun.patch, #53030 | |
Status | None | In Progress | |||
Summary | nano can open a different file than the intended one | when the working dir is gone, a different file than the intended one can be opened |
Powered by Savane 3.13-758e.
Corresponding source code
Released in nano-6.3.