mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Adding test case for symlink causes infinit loop, reproduces: dotcloud#5370
normally symlinks are created as either ln -s /path/existing /path/new-name or cd /path && ln -s ./existing new-name but one can create it this way cd /path && ln -s existing new-name this drives FollowSymlinkInScope into infinite loop Docker-DCO-1.1-Signed-off-by: Lajos Papp <lajos.papp@sequenceiq.com> (github: lalyos)
This commit is contained in:
		
							parent
							
								
									e5a5808f51
								
							
						
					
					
						commit
						8b77a5b7ae
					
				
					 2 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -28,6 +28,19 @@ func TestFollowSymLinkNormal(t *testing.T) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestFollowSymLinkRelativePath(t *testing.T) {
 | 
			
		||||
	link := "testdata/fs/i"
 | 
			
		||||
 | 
			
		||||
	rewrite, err := FollowSymlinkInScope(link, "testdata")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if expected := abs(t, "testdata/fs/a"); expected != rewrite {
 | 
			
		||||
		t.Fatalf("Expected %s got %s", expected, rewrite)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestFollowSymLinkUnderLinkedDir(t *testing.T) {
 | 
			
		||||
	dir, err := ioutil.TempDir("", "docker-fs-test")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								pkg/symlink/testdata/fs/i
									
										
									
									
										vendored
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								pkg/symlink/testdata/fs/i
									
										
									
									
										vendored
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
a
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue