unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: write-file could carry permissions
       [not found] <87ptmpm75y.fsf@jidanni.org>
@ 2003-05-13  1:47 ` Richard Stallman
  2003-05-13  4:39   ` Thien-Thi Nguyen
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Richard Stallman @ 2003-05-13  1:47 UTC (permalink / raw)
  Cc: emacs-devel

    $ chmod +x something
    $ emacs something
    C-x C-w somethingelse
    $ ls -l #shows that the executable permissions were not carried along,
    as a convenience...

If you write the buffer into a different file, I don't see why the
permissions would be the same.  However, this suggested to me that
maybe Emacs should always set the executable bit when you edit a file
in Shell Script mode.  Is there any reason that would be bad?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: write-file could carry permissions
  2003-05-13  1:47 ` write-file could carry permissions Richard Stallman
@ 2003-05-13  4:39   ` Thien-Thi Nguyen
  2003-05-13 10:28     ` Ehud Karni
  2003-05-13  7:13   ` Dan Jacobson
  2003-05-13 14:12   ` Stefan Monnier
  2 siblings, 1 reply; 5+ messages in thread
From: Thien-Thi Nguyen @ 2003-05-13  4:39 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

   maybe Emacs should always set the executable bit when you edit
   a file in Shell Script mode.  Is there any reason that would be
   bad?

if you write a file in a directory where some cron-driven script
walker sees it, it is better if that file is not executable unless
you explicitly make it so.  (principle of least surprise according
to the sysadmin.)

on the other hand, there's no problem w/ emacs providing a
convenient way to effect this decision (e.g., a write-file hook
subject to y-or-n-p).

thi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: write-file could carry permissions
  2003-05-13  1:47 ` write-file could carry permissions Richard Stallman
  2003-05-13  4:39   ` Thien-Thi Nguyen
@ 2003-05-13  7:13   ` Dan Jacobson
  2003-05-13 14:12   ` Stefan Monnier
  2 siblings, 0 replies; 5+ messages in thread
From: Dan Jacobson @ 2003-05-13  7:13 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "RMS" == Richard Stallman <rms@gnu.org> writes:

RMS>     $ chmod +x something
RMS>     $ emacs something
RMS>     C-x C-w somethingelse
RMS>     $ ls -l #shows that the executable permissions were not carried along,
RMS>     as a convenience...

RMS> If you write the buffer into a different file, I don't see why the
RMS> permissions would be the same.  However, this suggested to me that
RMS> maybe Emacs should always set the executable bit when you edit a file
RMS> in Shell Script mode.  Is there any reason that would be bad?

Well, I wasn't asking for it to go that far.  Now look what I've
started. OK, never mind my request.
-- 
http://jidanni.org/ Taiwan(04)25854780

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: write-file could carry permissions
  2003-05-13  4:39   ` Thien-Thi Nguyen
@ 2003-05-13 10:28     ` Ehud Karni
  0 siblings, 0 replies; 5+ messages in thread
From: Ehud Karni @ 2003-05-13 10:28 UTC (permalink / raw)
  Cc: emacs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 13 May 2003 00:39:27 -0400, Thien-Thi Nguyen <ttn@glug.org> wrote:
> 
>    maybe Emacs should always set the executable bit when you edit
>    a file in Shell Script mode.  Is there any reason that would be
>    bad?
> 
> if you write a file in a directory where some cron-driven script
> walker sees it, it is better if that file is not executable unless
> you explicitly make it so.  (principle of least surprise according
> to the sysadmin.)
> 
> on the other hand, there's no problem w/ emacs providing a
> convenient way to effect this decision (e.g., a write-file hook
> subject to y-or-n-p).

There is an autoloaded function supplied in current emacs (21.3) that
does that - `executable-make-buffer-file-executable-if-script-p' in 
progmode/executable.el. Just add it to `after-save-hook'.

BTW. Beside Thien-Thi reservation about cron confusion, there is also
the problem of trying to change file mode on remote system (ange-ftp)
that usually fails (remote chmod not supported).

Ehud.


- -- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+wMjHLFvTvpjqOY0RApHKAJ9wk3cZPHx5R8/73iXEf4NFwg+pxQCfX9Ed
RN/VHFQueZXC6pXBz05xtRQ=
=2x+H
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: write-file could carry permissions
  2003-05-13  1:47 ` write-file could carry permissions Richard Stallman
  2003-05-13  4:39   ` Thien-Thi Nguyen
  2003-05-13  7:13   ` Dan Jacobson
@ 2003-05-13 14:12   ` Stefan Monnier
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2003-05-13 14:12 UTC (permalink / raw)
  Cc: emacs-devel

>     $ chmod +x something
>     $ emacs something
>     C-x C-w somethingelse
>     $ ls -l #shows that the executable permissions were not carried along,
>     as a convenience...
> 
> If you write the buffer into a different file, I don't see why the
> permissions would be the same.  However, this suggested to me that
> maybe Emacs should always set the executable bit when you edit a file
> in Shell Script mode.  Is there any reason that would be bad?

As someone already pointed out,
we have make-buffer-file-executable-if-script-p and I recommend everybody
add it to his after-save-hook.

As for making all sh-script mode buffer executable, I strongly
oppose this idea, since many script files are never meant to be executed,
but only sourced (this is the case for .bashrc kind of things for example,
but also for many other files when you write an extensive script and
split it into modules/libraries/...).

Another reason why I oppose this idea is because the after-save-hook
setting above is a much better solution which also covers awk scripts,
prl scripts, foo scripts, bar scripts, ...


	Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-05-13 14:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87ptmpm75y.fsf@jidanni.org>
2003-05-13  1:47 ` write-file could carry permissions Richard Stallman
2003-05-13  4:39   ` Thien-Thi Nguyen
2003-05-13 10:28     ` Ehud Karni
2003-05-13  7:13   ` Dan Jacobson
2003-05-13 14:12   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).