GeezerVison is showing github.com — [MSHARED-1176] Test case for NoSuchFileException while copying symbolic by kwin · Pull Request #110 · apache/maven-shared-utils
Conversation
link with relative non-existing target
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
kwin
commented
Jul 26, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
@slawekjaranowski This depends on #109 being merged first otherwise the build breaks even before executing the unit test.
Update: Done and rebased this PR.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
michael-o
commented
Jul 26, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Without testing your PR, here is what I see on FreeBSD (FreeBSD bsd1srv.fritz.box 12.3-STABLE FreeBSD 12.3-STABLE GENERIC amd64) where chmod -h works as expected:
mosipov@bsd1srv:/usr/home/mosipov/var/Projekte/maven-shared-utils (master =)
$ grep chmod /tmp/out
fchmod(188,0100644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/classes/org/apache/maven/shared/utils/annotations.xml",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/classes/org/apache/maven/shared/utils/annotations.xml",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/classes/META-INF/LICENSE",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/classes/META-INF/LICENSE",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/classes/META-INF/DEPENDENCIES",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/classes/META-INF/DEPENDENCIES",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/classes/META-INF/NOTICE",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/classes/META-INF/NOTICE",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/directorywalker/directory1/file1.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/directorywalker/directory1/file1.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/directorywalker/directory2/directory21/file21.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/directorywalker/directory2/directory21/file21.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/directorywalker/directory2/file2.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/directorywalker/directory2/file2.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/directorywalker/file.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/directorywalker/file.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/expand/expand_test.zip",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/expand/expand_test.zip",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/targetDir/targetFile.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/targetDir/targetFile.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/fileR.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/fileR.txt",0644) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/symLinkToFileOnTheOutside",0644) ERR#2 'No such file or directory'
and
mosipov@bsd1srv:/usr/home/mosipov/var/Projekte/maven-shared-utils (master =)
$ grep symLinkToFileOnTheOutside /tmp/out
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/symLinkToFileOnTheOutside",0x7fffdfffc1f0,0x0) ERR#2 'No such file or directory'
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/symLinkToFileOnTheOutside",{ mode=lrwxr-xr-x ,inode=91832,size=19,blksize=131072 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
unlink("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/symLinkToFileOnTheOutside") = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/symLinkToFileOnTheOutside",0x7fffdfffc460,0x0) ERR#2 'No such file or directory'
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=lrwxr-xr-x ,inode=91158,size=19,blksize=131072 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
readlink("/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside","../onTheOutside.txt",1025) = 19 (0x13)
access("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/symLinkToFileOnTheOutside",F_OK) ERR#2 'No such file or directory'
symlink("../onTheOutside.txt","/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/symLinkToFileOnTheOutside") = 0 (0x0)
fstatat(AT_FDCWD,"/var/mosipov/Projekte/maven-shared-utils/src/test/resources/symlinks/src/symLinkToFileOnTheOutside",{ mode=-rw-r--r-- ,inode=91148,size=839,blksize=4096 },0x0) = 0 (0x0)
chmod("/var/mosipov/Projekte/maven-shared-utils/target/test-classes/symlinks/src/symLinkToFileOnTheOutside",0644) ERR#2 'No such file or directory'
The symlink or its target does not exist.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Yes, exactly. In this case the target does not (yet) exist. The question is how FileUtils.copyFile(...) should behave in that case.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
link with relative non-existing target
|
I'll try to look into this this month.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
IMHO copy should also not fail in case the source symlink is broken (which it currently does)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
michael-o
commented
Jul 26, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
IMHO copy should also not fail in case the source symlink is broken (which it currently does)
I agree with that. If source leads to nowhere then dest should do too. Fully valid with POSIX.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
IMHO copy should also not fail in case the source symlink is broken (which it currently does)
I added another (failing) test case for this scenario in 8ff14a5
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
From my PoV, it should mimic cp(1).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
kwin
changed the title
[MSHARED-1112] Test case for NoSuchFileException while copying symbolic
[MSHARED-1176] Test case for NoSuchFileException while copying symbolic
Jan 1, 2023
Uh oh!
There was an error while loading. Please reload this page.
|
|
tempFolder.newFolder( "destDirectory" ),
|
|
|
"toSymLink"
|
|
|
);
|
|
|
// this creates a symlink in a new folder pointing to a non-existing relative target "./target.txt"
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
"toSymLink"
|
|
|
);
|
|
|
// this creates a symlink in a new folder pointing to a non-existing relative target "./non-existing.txt"
|
|
|
FileUtils.copyFile( from.toFile(), to, null, (FileUtils.FilterWrapper[]) null );
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@kwin feel free to merge it if it is still relevant
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
bug
Something isn't working
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|