Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
strange thing after moving a directory
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
phil-news-nos...@ipal.net  
View profile  
 More options Nov 7, 7:18 am
Newsgroups: comp.os.linux.development.system
From: phil-news-nos...@ipal.net
Date: 6 Nov 2009 20:18:25 GMT
Local: Sat, Nov 7 2009 7:18 am
Subject: strange thing after moving a directory
I was editing some files in a subdirectory of a project (which itself is a
subdirectory of a directory named "projects").  After concluding this edit
I decided I wanted to have the option to revert my changes.  Since this is
not being doing in a revision management system, and instead I have backups
of different versions, I decided to do the following steps:

1.  In a shell session that was not involved in previous edits, I changed
    to the "projects" directory.

2.  I renamed the directory for the project to bump the version number.
    These directory names have the version number appended.  Now I have a
    "hole" in the directory names.

3.  I used rsync to copy the original directory name from a backup, thus
    filling in the "hole" with the old contents.

Eight total shell sessions were in various subdirectories of the project,
including the one I did the editing in.  What I expected to happen, and what
normally happens, is that the current directory of these shell sessions stays
with the actual directory inode.  So when I do the command "pwd" I expect to
now be in a subdirectory of the renamed project directory.  For most of the
shell sessions that was the case.  However, in two of the shell session this
was NOT the case.  These shell sessions still show as being in the old name.
These two were NOT involved in doing any editing.  What I did in these two
shell sessions was "ld -Al" giving the name of the subdirectory that edited
files were in, prefixed with "../".  In the shell sessions that did have the
expected (bumped) directory name, this command showed the expected files as
having been edited.  But, in the two shell sessions that did not have the
expected directory name, at least they were consistent and showed the files
that were edited, in their original (before editing) dates and sizes.

I am assuming that somehow these two shell sessions changed directory and are
now in the equivalent directory of the directories retrieved from the backup
via rsync.

The shell in all cases is BASH version 3.1.17.
The Linux kernel is 2.6.26.2 which I compiled with gcc 4.1.2.
The filesystem is ReiserFS.
The machine is i686 Intel(R) Core(TM)2 Quad CPU Q6700 @ 2.66GHz GenuineIntel

Is this some weird artifact of the shell that can just sometimes happen?
Do I have some kernel corruption (this machine does not have ECC memory)?
Do I have file system corruption?
Any idea what happened?

--
--------------------------------------------------------------------------- --
| Phil Howard KA9WGN       | http://linuxhomepage.com/      http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/   http://ka9wgn.ham.org/ |
--------------------------------------------------------------------------- --


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Nichols  
View profile  
 More options Nov 8, 3:24 am
Newsgroups: comp.os.linux.development.system
From: Robert Nichols <SEE_SIGNAT...@localhost.localdomain.invalid>
Date: Sat, 7 Nov 2009 10:24:11 -0600 (CST)
Local: Sun, Nov 8 2009 3:24 am
Subject: Re: strange thing after moving a directory
In article <hd20ah01...@news5.newsguy.com>,  <phil-news-nos...@ipal.net> wrote:

:I was editing some files in a subdirectory of a project (which itself is a
:subdirectory of a directory named "projects").  After concluding this edit
:I decided I wanted to have the option to revert my changes.  Since this is
:not being doing in a revision management system, and instead I have backups
:of different versions, I decided to do the following steps:
:
:1.  In a shell session that was not involved in previous edits, I changed
:    to the "projects" directory.
:
:2.  I renamed the directory for the project to bump the version number.
:    These directory names have the version number appended.  Now I have a
:    "hole" in the directory names.
:
:3.  I used rsync to copy the original directory name from a backup, thus
:    filling in the "hole" with the old contents.
:
:Eight total shell sessions were in various subdirectories of the project,
:including the one I did the editing in.  What I expected to happen, and what
:normally happens, is that the current directory of these shell sessions stays
:with the actual directory inode.  So when I do the command "pwd" I expect to
:now be in a subdirectory of the renamed project directory.  For most of the
:shell sessions that was the case.  However, in two of the shell session this
:was NOT the case.  These shell sessions still show as being in the old name.
:These two were NOT involved in doing any editing.  What I did in these two
:shell sessions was "ld -Al" giving the name of the subdirectory that edited
:files were in, prefixed with "../".  In the shell sessions that did have the
:expected (bumped) directory name, this command showed the expected files as
:having been edited.  But, in the two shell sessions that did not have the
:expected directory name, at least they were consistent and showed the files
:that were edited, in their original (before editing) dates and sizes.
:
:I am assuming that somehow these two shell sessions changed directory and are
:now in the equivalent directory of the directories retrieved from the backup
:via rsync.

The shell does not know that its current working directory has been
renamed.  The shell keeps its notion of the current directory in its
internal PWD variable.  What you run when you just type "pwd" is a shell
builtin that just reports the value of $PWD.  You would have to run
"/bin/pwd" explicitly to see the current name of your working directory.

There is a similar issue if you have reached your current directory by
traversing symlinks.  Typing "pwd" shows the symlink path that the shell
recorded in $PWD, while "/bin/pwd" will show the real path.

--
Bob Nichols         AT comcast.net I am "RNichols42"


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google