all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Setting Group Ownership
@ 2002-12-10 14:14 CarlC
  2002-12-10 14:45 ` Tim Haynes
  2002-12-10 14:56 ` Stein A. Stromme
  0 siblings, 2 replies; 8+ messages in thread
From: CarlC @ 2002-12-10 14:14 UTC (permalink / raw)


When a file is saved I would like to set the file's group owner to an
environment variable. This is on a Linux box. I know that I can use
after-save-hook. I assume that I would have to call a shell command to do
this. I don't know how access an environment variable and call the chgrp
command from emacs. Any help would be appreciated.

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

* Re: Setting Group Ownership
  2002-12-10 14:14 Setting Group Ownership CarlC
@ 2002-12-10 14:45 ` Tim Haynes
  2002-12-10 21:13   ` CarlC
  2002-12-10 14:56 ` Stein A. Stromme
  1 sibling, 1 reply; 8+ messages in thread
From: Tim Haynes @ 2002-12-10 14:45 UTC (permalink / raw)


"CarlC" <carlc@snowbd.com> writes:

> When a file is saved I would like to set the file's group owner to an
> environment variable. This is on a Linux box. I know that I can use
> after-save-hook. I assume that I would have to call a shell command to do
> this. I don't know how access an environment variable and call the chgrp
> command from emacs. Any help would be appreciated.

Consider:

M-: (shell-command (concat "echo " (getenv "HOME")))

change a couple of things, you might have got what you want? :8)

~Tim
-- 
A spark of life                             |piglet@stirfried.vegetable.org.uk
On a wire from heaven                       |http://spodzone.org.uk/

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

* Re: Setting Group Ownership
  2002-12-10 14:14 Setting Group Ownership CarlC
  2002-12-10 14:45 ` Tim Haynes
@ 2002-12-10 14:56 ` Stein A. Stromme
  1 sibling, 0 replies; 8+ messages in thread
From: Stein A. Stromme @ 2002-12-10 14:56 UTC (permalink / raw)


[carlc@snowbd.com]

| When a file is saved I would like to set the file's group owner to an
| environment variable. This is on a Linux box. I know that I can use
| after-save-hook. I assume that I would have to call a shell command to do
| this. I don't know how access an environment variable and call the chgrp
| command from emacs. Any help would be appreciated.

Look into getenv:

    getenv is an interactive compiled Lisp function in `env'.
    (getenv VARIABLE)

    Get the value of environment variable VARIABLE.
    VARIABLE should be a string.  Value is nil if VARIABLE is undefined in
    the environment.  Otherwise, value is a string.

    This function consults the variable `process-environment'
    for its value.

There is also dired-do-chgrp which perhaps could be used (or suitably
modified for your purpose).
-- 
Stein Arild Strømme            +47 55584825, +47 95801887
Universitetet i Bergen                  Fax: +47 55589672     
Matematisk institutt               www.mi.uib.no/~stromme         
Johs Brunsg 12, N-5008 BERGEN           stromme@mi.uib.no

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

* Re: Setting Group Ownership
  2002-12-10 14:45 ` Tim Haynes
@ 2002-12-10 21:13   ` CarlC
  2002-12-10 23:40     ` Kevin Rodgers
  0 siblings, 1 reply; 8+ messages in thread
From: CarlC @ 2002-12-10 21:13 UTC (permalink / raw)


"Tim Haynes" <usenet@stirfried.vegetable.org.uk> wrote in message
news:86vg22ue4o.fsf@potato.vegetable.org.uk...
> M-: (shell-command (concat "echo " (getenv "HOME")))

Thanks, Tim. One thing that I forgot to ask about is the name of the
variable that contains the filename that was just saved so that I can do the
chgrp command on it.

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

* Re: Setting Group Ownership
  2002-12-10 21:13   ` CarlC
@ 2002-12-10 23:40     ` Kevin Rodgers
  2002-12-11 10:55       ` Tim Haynes
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Rodgers @ 2002-12-10 23:40 UTC (permalink / raw)


CarlC wrote:

> "Tim Haynes" <usenet@stirfried.vegetable.org.uk> wrote in message
> news:86vg22ue4o.fsf@potato.vegetable.org.uk...
> 
>>M-: (shell-command (concat "echo " (getenv "HOME")))
>>
> 
> Thanks, Tim. One thing that I forgot to ask about is the name of the
> variable that contains the filename that was just saved so that I can do the
> chgrp command on it.


C-h v buffer-file-name

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: Setting Group Ownership
  2002-12-10 23:40     ` Kevin Rodgers
@ 2002-12-11 10:55       ` Tim Haynes
  2002-12-11 14:27         ` CarlC
  0 siblings, 1 reply; 8+ messages in thread
From: Tim Haynes @ 2002-12-11 10:55 UTC (permalink / raw)


Kevin Rodgers <kevinr@ihs.com> writes:

> CarlC wrote:
>
>> "Tim Haynes" <usenet@stirfried.vegetable.org.uk> wrote in message
>> news:86vg22ue4o.fsf@potato.vegetable.org.uk...
>>
>>>M-: (shell-command (concat "echo " (getenv "HOME")))
>>>
>> Thanks, Tim. One thing that I forgot to ask about is the name of the
>> variable that contains the filename that was just saved so that I can do the
>> chgrp command on it.
>
> C-h v buffer-file-name

While I'm passing: is there some reason that asserting the setgid bit on
the directory would be a bad idea?

~Tim
-- 
Clouds cross the black moonlight,           |piglet@stirfried.vegetable.org.uk
Rushing on down to the sound                |http://spodzone.org.uk/
of a turning world                          |

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

* Re: Setting Group Ownership
  2002-12-11 10:55       ` Tim Haynes
@ 2002-12-11 14:27         ` CarlC
  2002-12-12 14:15           ` Tim Haynes
  0 siblings, 1 reply; 8+ messages in thread
From: CarlC @ 2002-12-11 14:27 UTC (permalink / raw)


"Tim Haynes" <usenet@stirfried.vegetable.org.uk> wrote in message
news:863cp4su33.fsf@potato.vegetable.org.uk...
> While I'm passing: is there some reason that asserting the setgid bit on
> the directory would be a bad idea?

Since you asked, Tim...Yes. This goes back to a design from my younger unix
days. Actual users are running as client logins and the files are owned by
these pseudo-users. I have an environment variable that contains the actual
user. I want to set the group id of a file to reflect who actually changed
this client's file. This is why just fixing it to the directory's group id
is not what I want.

I have this process working, now. Thanks to all who helped me.

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

* Re: Setting Group Ownership
  2002-12-11 14:27         ` CarlC
@ 2002-12-12 14:15           ` Tim Haynes
  0 siblings, 0 replies; 8+ messages in thread
From: Tim Haynes @ 2002-12-12 14:15 UTC (permalink / raw)


"CarlC" <carlc@snowbd.com> writes:

> "Tim Haynes" <usenet@stirfried.vegetable.org.uk> wrote in message
> news:863cp4su33.fsf@potato.vegetable.org.uk...
>> While I'm passing: is there some reason that asserting the setgid bit on
>> the directory would be a bad idea?
>
> Since you asked, Tim...Yes. This goes back to a design from my younger
> unix days. Actual users are running as client logins and the files are
> owned by these pseudo-users. I have an environment variable that contains
> the actual user. I want to set the group id of a file to reflect who
> actually changed this client's file. This is why just fixing it to the
> directory's group id is not what I want.

Ah, OK, I think I understand :)

> I have this process working, now. Thanks to all who helped me.

Goodie :8)

~Tim
-- 
I never knew that the                       |piglet@stirfried.vegetable.org.uk
light of ages breaks the way before us      |http://spodzone.org.uk/

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

end of thread, other threads:[~2002-12-12 14:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-10 14:14 Setting Group Ownership CarlC
2002-12-10 14:45 ` Tim Haynes
2002-12-10 21:13   ` CarlC
2002-12-10 23:40     ` Kevin Rodgers
2002-12-11 10:55       ` Tim Haynes
2002-12-11 14:27         ` CarlC
2002-12-12 14:15           ` Tim Haynes
2002-12-10 14:56 ` Stein A. Stromme

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.