diff options
Diffstat (limited to 'debian/patches/dyson-acl-dirty.patch')
-rw-r--r-- | debian/patches/dyson-acl-dirty.patch | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/debian/patches/dyson-acl-dirty.patch b/debian/patches/dyson-acl-dirty.patch new file mode 100644 index 00000000..f484d731 --- /dev/null +++ b/debian/patches/dyson-acl-dirty.patch @@ -0,0 +1,144 @@ +Description: ls --acl prints ACLs (illumos only) +Bug-Dyson: http://osdyson.org/issues/106 +Index: coreutils/src/ls.c +=================================================================== +--- coreutils.orig/src/ls.c ++++ coreutils/src/ls.c +@@ -49,6 +49,8 @@ + # include <sys/ptem.h> + #endif + ++#include <sys/acl.h> ++ + #include <stdio.h> + #include <assert.h> + #include <setjmp.h> +@@ -185,7 +187,7 @@ verify (sizeof filetype_letter - 1 == ar + C_LINK, C_SOCK, C_FILE, C_DIR \ + } + +-enum acl_type ++enum ls_acl_type + { + ACL_T_NONE, + ACL_T_LSM_CONTEXT_ONLY, +@@ -219,7 +221,7 @@ struct fileinfo + + /* For long listings, true if the file has an access control list, + or a security context. */ +- enum acl_type acl_type; ++ enum ls_acl_type ls_acl_type; + + /* For color listings, true if a regular file has capability info. */ + bool has_capability; +@@ -271,6 +273,7 @@ static void print_horizontal (void); + static int format_user_width (uid_t u); + static int format_group_width (gid_t g); + static void print_long_format (const struct fileinfo *f); ++static void do_print_acl (const struct fileinfo *f); + static void print_many_per_line (void); + static size_t print_name_with_quoting (const struct fileinfo *f, + bool symlink_target, +@@ -356,6 +359,7 @@ static struct pending *pending_dirs; + static struct timespec current_time; + + static bool print_scontext; ++static bool print_acl; + static char UNKNOWN_SECURITY_CONTEXT[] = "?"; + + /* Whether any of the files has an ACL. This affects the width of the +@@ -799,7 +803,8 @@ enum + SI_OPTION, + SORT_OPTION, + TIME_OPTION, +- TIME_STYLE_OPTION ++ TIME_STYLE_OPTION, ++ ACL_OPTION, + }; + + static struct option const long_options[] = +@@ -845,6 +850,7 @@ static struct option const long_options[ + {"color", optional_argument, NULL, COLOR_OPTION}, + {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION}, + {"context", no_argument, 0, 'Z'}, ++ {"acl", no_argument, 0, ACL_OPTION}, + {"author", no_argument, NULL, AUTHOR_OPTION}, + {GETOPT_HELP_OPTION_DECL}, + {GETOPT_VERSION_OPTION_DECL}, +@@ -1579,6 +1585,7 @@ decode_switches (int argc, char **argv) + ignore_patterns = NULL; + hide_patterns = NULL; + print_scontext = false; ++ print_acl = false; + + getenv_quoting_style (); + +@@ -1932,6 +1939,11 @@ decode_switches (int argc, char **argv) + print_scontext = true; + break; + ++ case ACL_OPTION: ++ print_acl = true; ++ format = long_format; ++ break; ++ + case_GETOPT_HELP_CHAR; + + case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); +@@ -3076,12 +3088,12 @@ gobble_file (char const *name, enum file + have_acl = (0 < n); + } + +- f->acl_type = (!have_scontext && !have_acl ++ f->ls_acl_type = (!have_scontext && !have_acl + ? ACL_T_NONE + : (have_scontext && !have_acl + ? ACL_T_LSM_CONTEXT_ONLY + : ACL_T_YES)); +- any_has_acl |= f->acl_type != ACL_T_NONE; ++ any_has_acl |= f->ls_acl_type != ACL_T_NONE; + + if (err) + error (0, errno, "%s", quotearg_colon (absolute_name)); +@@ -3807,6 +3819,19 @@ format_inode (char *buf, size_t buflen, + : (char *) "?"); + } + ++/* Print ACL for F. */ ++static void ++do_print_acl (const struct fileinfo *f) ++{ ++ acl_t *aclp; ++ if (0 == acl_get(f->name, 0, &aclp) && NULL != aclp) { ++ putchar('\n'); ++ acl_printacl(aclp, 80, 0); ++ acl_free(aclp); ++ } ++ ++} ++ + /* Print information about F in long format. */ + static void + print_long_format (const struct fileinfo *f) +@@ -3838,9 +3863,9 @@ print_long_format (const struct fileinfo + } + if (! any_has_acl) + modebuf[10] = '\0'; +- else if (f->acl_type == ACL_T_LSM_CONTEXT_ONLY) ++ else if (f->ls_acl_type == ACL_T_LSM_CONTEXT_ONLY) + modebuf[10] = '.'; +- else if (f->acl_type == ACL_T_YES) ++ else if (f->ls_acl_type == ACL_T_YES) + modebuf[10] = '+'; + + switch (time_type) +@@ -4026,6 +4051,9 @@ print_long_format (const struct fileinfo + } + else if (indicator_style != none) + print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype); ++ ++ if (f->filetype != symbolic_link && print_acl) ++ do_print_acl(f); + } + + /* Output to OUT a quoted representation of the file name NAME, |