PATCH: cause 'install' to set the executable bit by default

Denys Vlasenko vda.linux at googlemail.com
Mon Jun 15 16:13:42 UTC 2009


On Mon, Jun 15, 2009 at 3:48 PM, Mat Hostetter<mhostetter at tilera.com> wrote:
> In busybox 1.14.1, the 'install' program does not default to making
> installed files executable like GNU install does.  This breaks the
> build for a particular app that expects its machine-generated shell
> scripts to become executable when 'install' copies them.
>
> For example here is the behavior of the normal GNU 'install':
>
> ld-1:~$ rm -f foo foo2
> ld-1:~$ touch foo
> ld-1:~$ ls -l foo
> -rw-r--r--  1 mhostetter users 0 Jun 15 09:38 foo
> ld-1:~$ install foo foo2
> ld-1:~$ ls -l foo2
> -rwxr-xr-x  1 mhostetter users 0 Jun 15 09:38 foo2
>
>
> and here is relevant documentation from the GNU install man page:
>
>       -m, --mode=MODE
>              set permission mode (as in chmod), instead of rwxr-xr-x
>
> GNU install does not appear to pay attention to 'umask'.
>
> This patch makes busybox 'install' set the executable bits when no
> explicit mode is specified, to match GNU install:
>
>
> --- busybox.orig/coreutils/install.c   2009-05-27 12:00:23.000000000 -0400
> +++ busybox/coreutils/install.c  2009-06-14 09:35:32.479951000 -0400
> @@ -129,7 +129,7 @@
>        if (opts & OPT_PRESERVE_TIME) {
>                copy_flags |= FILEUTILS_PRESERVE_STATUS;
>        }
> -       mode = 0666;
> +       mode = 0755;
>        if (opts & OPT_MODE)
>                bb_parse_mode(mode_str, &mode);
>        uid = (opts & OPT_OWNER) ? get_ug_id(uid_str, xuname2uid) : getuid();
> @@ -176,7 +176,7 @@
>                }
>
>                /* Set the file mode */
> -               if ((opts & OPT_MODE) && chmod(dest, mode) == -1) {
> +               if (chmod(dest, mode) == -1) {
>                        bb_perror_msg("can't change %s of %s", "permissions", dest);
>                        ret = EXIT_FAILURE;
>                }

Thanks, applied.
--
vda


More information about the busybox mailing list