From e3537c3376eaeaaa08b5426396d09072904024bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Tue, 25 May 2010 10:18:20 +0200 Subject: [PATCH] reversed default for showing/hiding hidden files --- src/lowntfs-3g.c | 19 +++++++++++-------- src/ntfs-3g.8.in | 11 +++++------ src/ntfs-3g.c | 17 ++++++++++------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 13c29ebe..2cf6e0e5 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -209,7 +209,7 @@ typedef struct { ntfs_atime_t atime; BOOL ro; BOOL show_sys_files; - BOOL show_hid_files; + BOOL hide_hid_files; BOOL hide_dot_files; BOOL ignore_case; BOOL windows_names; @@ -3654,8 +3654,13 @@ static int ntfs_open(const char *device) ntfs_log_perror("Failed to mount '%s'", device); goto err_out; } - if (ntfs_set_shown_files(vol, ctx->show_sys_files, - ctx->show_hid_files, ctx->hide_dot_files)) +#ifdef HAVE_SETXATTR + /* archivers must see hidden files */ + if (ctx->efs_raw) + ctx->hide_hid_files = FALSE; +#endif + if (ntfs_set_shown_files(ctx->vol, ctx->show_sys_files, + !ctx->hide_hid_files, ctx->hide_dot_files)) goto err_out; if (ctx->ignore_case && ntfs_set_ignore_case(vol)) @@ -3824,10 +3829,10 @@ static char *parse_mount_options(const char *orig_opts) if (bogus_option_value(val, "show_sys_files")) goto err_exit; ctx->show_sys_files = TRUE; - } else if (!strcmp(opt, "show_hid_files")) { - if (bogus_option_value(val, "show_hid_files")) + } else if (!strcmp(opt, "hide_hid_files")) { + if (bogus_option_value(val, "hide_hid_files")) goto err_exit; - ctx->show_hid_files = TRUE; + ctx->hide_hid_files = TRUE; } else if (!strcmp(opt, "hide_dot_files")) { if (bogus_option_value(val, "hide_dot_files")) goto err_exit; @@ -3949,8 +3954,6 @@ static char *parse_mount_options(const char *orig_opts) if (bogus_option_value(val, "efs_raw")) goto err_exit; ctx->efs_raw = TRUE; - /* show hidden files to archivers */ - ctx->show_hid_files = 1; #endif /* HAVE_SETXATTR */ } else { /* Probably FUSE option. */ if (strappend(&ret, opt)) diff --git a/src/ntfs-3g.8.in b/src/ntfs-3g.8.in index d476b58b..69d1a9a0 100644 --- a/src/ntfs-3g.8.in +++ b/src/ntfs-3g.8.in @@ -195,13 +195,12 @@ show_sys_files, all files are accessible by name, for example you can always do "ls \-l '$UpCase'". .TP -.B show_hid_files -Show the hidden files and directories in directory listings, the hidden files +.B hide_hid_files +Hide the hidden files and directories in directory listings, the hidden files and directories being the ones whose NTFS attribute have the hidden flag set. -This flag has no effect on files and directory whose first character of -the name is a dot. Furthermore, irrespectively of show_hid_files, all files -and directories are accessible by name, for example you can always display -the Windows trash bin directory by : +The hidden files will not be selected when using wildcards in commands, +but all files and directories remain accessible by full name, for example you +can always display the Windows trash bin directory by : "ls \-ld '$RECYCLE.BIN'". .TP .B hide_dot_files diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 10526bad..50bd80f9 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -170,7 +170,7 @@ typedef struct { ntfs_atime_t atime; BOOL ro; BOOL show_sys_files; - BOOL show_hid_files; + BOOL hide_hid_files; BOOL hide_dot_files; BOOL windows_names; BOOL silent; @@ -3607,8 +3607,13 @@ static int ntfs_open(const char *device) ntfs_log_perror("Failed to mount '%s'", device); goto err_out; } +#ifdef HAVE_SETXATTR + /* archivers must see hidden files */ + if (ctx->efs_raw) + ctx->hide_hid_files = FALSE; +#endif if (ntfs_set_shown_files(ctx->vol, ctx->show_sys_files, - ctx->show_hid_files, ctx->hide_dot_files)) + !ctx->hide_hid_files, ctx->hide_dot_files)) goto err_out; ctx->vol->free_clusters = ntfs_attr_get_free_bits(ctx->vol->lcnbmp_na); @@ -3774,10 +3779,10 @@ static char *parse_mount_options(const char *orig_opts) if (bogus_option_value(val, "show_sys_files")) goto err_exit; ctx->show_sys_files = TRUE; - } else if (!strcmp(opt, "show_hid_files")) { - if (bogus_option_value(val, "show_hid_files")) + } else if (!strcmp(opt, "hide_hid_files")) { + if (bogus_option_value(val, "hide_hid_files")) goto err_exit; - ctx->show_hid_files = TRUE; + ctx->hide_hid_files = TRUE; } else if (!strcmp(opt, "hide_dot_files")) { if (bogus_option_value(val, "hide_dot_files")) goto err_exit; @@ -3897,8 +3902,6 @@ static char *parse_mount_options(const char *orig_opts) if (bogus_option_value(val, "efs_raw")) goto err_exit; ctx->efs_raw = TRUE; - /* show hidden files to archivers */ - ctx->show_hid_files = 1; #endif /* HAVE_SETXATTR */ } else { /* Probably FUSE option. */ if (strappend(&ret, opt))