Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about filesystems to fs::rename #25128

Merged
merged 1 commit into from
May 27, 2015
Merged

Conversation

steveklabnik
Copy link
Member

@@ -844,6 +844,8 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {

/// Rename a file or directory to a new name.
///
/// This will not work if the new name is on a different filesystem.
///
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, on linux, this will not work across mount points even if the filesystems are the same.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stebalien by "filesystems are the same", is ext4 an example of a filesystem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filesystem as used in this comment (i.e. partition?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that you can have multiple mount points in the same partition?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that depends on the filesystem. The trivial example is bind mount which lets you mount a directory:

mkdir /path/to/a
mkdir /path/to/b
mount -o bind /path/to/a /path/to/b

These both have the same filesystem (the directory /path/to/a) but different mount points. See the EXDEV comment in man 2 rename (on linux).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, filesystem is rather ambiguous. Maybe @steveklabnik should simply say mount point?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, filesystem is incorrect on linux (both interpretations) HOWEVER, on reading the windows spec, I get the impression that you can rename files between mount points (you can mount drives in folders: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365733%28v=vs.85%29.aspx) as long as they refer to the same underlying filesystem (partition).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, impressive :)

@steveklabnik
Copy link
Member Author

r? @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+ 577bbac

@alexcrichton
Copy link
Member

@bors: rollup

Manishearth added a commit to Manishearth/rust that referenced this pull request May 27, 2015
Manishearth added a commit to Manishearth/rust that referenced this pull request May 27, 2015
bors added a commit that referenced this pull request May 27, 2015
@bors bors merged commit 577bbac into rust-lang:master May 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rename missing description details
5 participants