-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a cornercase in choosing whether to copy or link a file.
In the present code, when we have two separate links to the same file outside of /etc/pki, the real file is copied to the location of both links. The problem with this is when the user makes changes to the file in the future, they will have to edit both files whereas before they would only have had to edit one of the files (since they linked to the same underlying file). Example: Host: lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileA -> /etc/sourceFile lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileB -> /etc/sourceFile Becomes: -rw-r--r--. 1 badger badger 12 Jan 22 03:43 fileA -rw-r--r--. 1 badger badger 12 Jan 22 03:43 fileB fileA and fileB are separate copies of /etc/sourceFile. This change makes it so anytime two links eventually point to the same exterior file, the first link will be copied and the second link will becone a symlinks to that copy like this: -rw-r--r--. 1 badger badger 12 Jan 22 03:43 fileA lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileB -> /etc/pki/fileA This is the behaviour even if the second link went through several other exterior links to reach the same sourceFile (but not if there is another interior link in between). Example: Host: lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileA -> /etc/sourceFile lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileB -> /etc/sourceFile lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileC -> /etc/external-to-same-file lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileD -> /etc/external-to-interior-link lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 /etc/external-to-same-file -> /etc/sourceFile lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 /etc/external-to-interior-link -> pki/fileB Becomes: -rw-r--r--. 1 badger badger 12 Jan 22 03:43 fileA lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileB -> /etc/pki/fileA lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileC -> /etc/pki/fileA lrwxrwxrwx. 1 badger badger 13 Jan 22 03:42 fileD -> /etc/pki/fileB The drawback to the end user is that, unless you trace all the way through the chain of symlinks, it is confusing that fileA ends up being a real file and fileC ends up pointing to it. It's not immediately obvious how the two are related. The advantage is if the end user makes any changes to either fileA or fileC, then the changes will be visible in both files. This is the behaviour that existed on the host system.
- Loading branch information
Showing
2 changed files
with
128 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters