Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
why does the current folder stop being usable?
-
- Posts: 431
- Joined: 2018-11-05 21:30
why does the current folder stop being usable?
why the current folder stops being usable?
Sometimes in my git repo, I get this error, and I have to do "cd; cd -"
sh: 0: getcwd() failed: No such file or directory
I am using a webpack watch and the folder is on a mounted file with cifs
here is the fstab entry for the mounting.
//REPLACED_SECRET_PATH cifs user=externo,password=REPLACED,uid=1000,gid=1000,mfsymlinks
note:
this thead gives a hint:
https://askubuntu.com/questions/286467/ ... -directory
Sometimes in my git repo, I get this error, and I have to do "cd; cd -"
sh: 0: getcwd() failed: No such file or directory
I am using a webpack watch and the folder is on a mounted file with cifs
here is the fstab entry for the mounting.
//REPLACED_SECRET_PATH cifs user=externo,password=REPLACED,uid=1000,gid=1000,mfsymlinks
note:
this thead gives a hint:
https://askubuntu.com/questions/286467/ ... -directory
-
- Posts: 932
- Joined: 2020-05-03 14:16
- Has thanked: 7 times
- Been thanked: 68 times
Re: why does the current folder stop being usable?
Probably You have already discovered, that in Linux-based OS it's possible to delete and re-create a directory or file which is currently used by some other program. Whether this is a feature or bug, depends on a point of view, but there are practical reasons to have such functionality.
Anyway, in such case the fstat structure is changed (see fstat(2) )
The applications which have already obtained a file descriptor for that deleted/re-created file or directory will obviously return faults, because their file descriptors are no longer valid -> this also affects the shells -> that's why it's required to execute the "cd" command again.
Anyway, in such case the fstat structure is changed (see fstat(2) )
The applications which have already obtained a file descriptor for that deleted/re-created file or directory will obviously return faults, because their file descriptors are no longer valid -> this also affects the shells -> that's why it's required to execute the "cd" command again.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
The_full_story and Nothing_have_changed
-
- Posts: 431
- Joined: 2018-11-05 21:30
Re: why does the current folder stop being usable?
It seems dangerous that anything would delete recreate my folders. I don't think so.
IT seems to me more related to how mounting cifs works. And also related to a windows VM running a nodejs process on that same cifs.
IT seems to me more related to how mounting cifs works. And also related to a windows VM running a nodejs process on that same cifs.
-
- Posts: 932
- Joined: 2020-05-03 14:16
- Has thanked: 7 times
- Been thanked: 68 times
Re: why does the current folder stop being usable?
I was referring to the article from the askubuntu.com which You've referenced. Unmounting a filesystem also invalidates all the currently used file/directory descriptors.MagicPoulp wrote:It seems dangerous that anything would delete recreate my folders. I don't think so.
IT seems to me more related to how mounting cifs works. And also related to a windows VM running a nodejs process on that same cifs.
But I think that We need more details to explain what is actually happening. I'm guesing that the directory in question is just re-created during project synchronization (what invalidates the file/directory descriptors).
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
The_full_story and Nothing_have_changed
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: why does the current folder stop being usable?
No, it is not possible to delete a file or directory in use. You actually do not delete a file or directory with commands such as rm or rmdir, you only unlink it, i.e. delete the parent directory entry pointing to the inode. There may be multiple directory entries pointing to the same inode, each counting as a link. The file being used by a process also counts as a link. The file is actually deleted only after the last link is deleted.LE_746F6D617A7A69 wrote:in Linux-based OS it's possible to delete and re-create a directory or file which is currently used by some other program.
-
- Posts: 932
- Joined: 2020-05-03 14:16
- Has thanked: 7 times
- Been thanked: 68 times
Re: why does the current folder stop being usable?
Nope.p.H wrote:No, it is not possible to delete a file or directory in use. You actually do not delete a file or directory with commands such as rm or rmdir, you only unlink it, i.e. delete the parent directory entry pointing to the inode. There may be multiple directory entries pointing to the same inode, each counting as a link. The file being used by a process also counts as a link. The file is actually deleted only after the last link is deleted.LE_746F6D617A7A69 wrote:in Linux-based OS it's possible to delete and re-create a directory or file which is currently used by some other program.
Proof:
Open 2 terminal instances
terminal 1:
Code: Select all
mkdir testdir; cd testdir; touch testfile; ls
Code: Select all
rm -r testdir; mkdir testdir; cd testdir; touch testfile2; ls
Code: Select all
ls
Now, in terminal 1:
Code: Select all
cd ..; cd testdir; ls
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
The_full_story and Nothing_have_changed
Re: why does the current folder stop being usable?
That's true, but does "standing" in a directory (having it as current directory) count as the directory being in use?p.H wrote:You actually do not delete a file or directory with commands such as rm or rmdir, you only unlink it, i.e. delete the parent directory entry pointing to the inode. There may be multiple directory entries pointing to the same inode, each counting as a link. The file being used by a process also counts as a link. The file is actually deleted only after the last link is deleted.
-
- Posts: 932
- Joined: 2020-05-03 14:16
- Has thanked: 7 times
- Been thanked: 68 times
Re: why does the current folder stop being usable?
Nope, Test2:Islander wrote:That's true, but does "standing" in a directory (having it as current directory) count as the directory being in use?p.H wrote:You actually do not delete a file or directory with commands such as rm or rmdir, you only unlink it, i.e. delete the parent directory entry pointing to the inode. There may be multiple directory entries pointing to the same inode, each counting as a link. The file being used by a process also counts as a link. The file is actually deleted only after the last link is deleted.
terminal 1:
Code: Select all
mkdir testdir; cd testdir; touch testfile; less testfile
terminal 2:
Code: Select all
rm -r testdir; mkdir testdir; cd testdir; touch testfile2; less testfile2
terminal 1: type 'q' to quit less, then type 'ls'
Code: Select all
ls
Re-creation or deletion of a directory or file currently opened in some other program is possible in UNIX/BSD/Linux.
This also works on a very low level (descriptors) and if the above examples are not sufficient, I can spend another 5 minutes to demonstrate this behaviour on a C-code level.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
The_full_story and Nothing_have_changed