Skip to content
Snippets Groups Projects
Commit 7a3f5a1d authored by George Nachman's avatar George Nachman
Browse files

Change how network automounts are detected. Issue 5740

I had misunderstood how auto_master works. Its maps refer to files or certain harcoded values. Actually parsing it properly is difficult, so I'll take a conservative approach for now and ignore any mountpoint mentioned in it.
parent e33238a1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -201,8 +201,7 @@ NSString * const DirectoryLocationDomain = @"DirectoryLocationDomain";
DLog(@"Additional network paths are: %@", additionalNetworkPaths);
// Augment list of additional paths with nfs automounter mount points.
NSMutableArray *networkPaths = [[additionalNetworkPaths mutableCopy] autorelease];
NSSet<NSString *> *maps = [NSSet setWithObjects:@"auto_nfs", @"auto_home", nil];
[networkPaths addObjectsFromArray:[[iTermAutoMasterParser sharedInstance] mountpointsWithMaps:maps]];
[networkPaths addObjectsFromArray:[[iTermAutoMasterParser sharedInstance] mountpoints]];
for (NSString *path in networkPaths) {
if (!path.length) {
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@
 
+ (instancetype)sharedInstance;
 
// Returns mountpoints having a given map.
- (NSArray<NSString *> *)mountpointsWithMaps:(NSSet<NSString *> *)maps;
// Returns all auto_master mountpoints. This is a conservative guess at what might be an nfs mount.
- (NSArray<NSString *> *)mountpoints;
 
@end
Loading
Loading
@@ -9,6 +9,7 @@
#import "iTermAutoMasterParser.h"
 
#import "DebugLogging.h"
#import "NSArray+iTerm.h"
 
// Represents an entry in /etc/auto_master.
@interface iTermAutoMasterEntry : NSObject
Loading
Loading
@@ -99,15 +100,10 @@
return self;
}
 
- (NSArray<NSString *> *)mountpointsWithMaps:(NSSet<NSString *> *)maps {
NSMutableArray<NSString *> *result = [NSMutableArray array];
for (iTermAutoMasterEntry *entry in _entries) {
if (entry.map && [maps containsObject:entry.map]) {
DLog(@"Found NFS automounter at %@ mapped to %@", entry.mountpoint, entry.map);
[result addObject:entry.mountpoint];
}
}
return result;
- (NSArray<NSString *> *)mountpoints {
return [_entries mapWithBlock:^id(iTermAutoMasterEntry *anObject) {
return anObject.mountpoint;
}];
}
 
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment