Merge pull request #461 from priyawadhwa/etc-bug
Only return filepath.SkipDir for directories
This commit is contained in:
		
						commit
						ade42d9105
					
				|  | @ -0,0 +1,11 @@ | ||||||
|  | # Make sure that whitelisting (specifically, filepath.SkipDir) works correctly, and that /var/test/testfile and | ||||||
|  | # /etc/test/testfile end up in the final image | ||||||
|  | 
 | ||||||
|  | FROM debian@sha256:38236c068c393272ad02db100e09cac36a5465149e2924a035ee60d6c60c38fe | ||||||
|  | 
 | ||||||
|  | RUN mkdir -p /var/test \ | ||||||
|  |     && mkdir -p /etc/test \ | ||||||
|  |     && touch /var/test/testfile \ | ||||||
|  |     && touch /etc/test/testfile \ | ||||||
|  |     && ls -lah /var/test \ | ||||||
|  |     && ls -lah /etc/test; | ||||||
|  | @ -147,9 +147,12 @@ func (s *Snapshotter) TakeSnapshotFS() (string, error) { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
| 		if util.IsInWhitelist(path) { | 		if util.IsInWhitelist(path) { | ||||||
|  | 			if util.IsDestDir(path) { | ||||||
| 				logrus.Infof("Skipping paths under %s, as it is a whitelisted directory", path) | 				logrus.Infof("Skipping paths under %s, as it is a whitelisted directory", path) | ||||||
| 				return filepath.SkipDir | 				return filepath.SkipDir | ||||||
| 			} | 			} | ||||||
|  | 			return nil | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		memFs[path] = info | 		memFs[path] = info | ||||||
| 		return nil | 		return nil | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue