Re: problem with tumme.el

2007-01-14 Thread Mathias Dahl
Stefan Monnier [EMAIL PROTECTED] writes:

 shell-file-name is /bin/bash.

 That's the bug.  `shell-file-name' should be /bin/sh.

Really? The doc says:

   shell-file-name is a variable defined in `C source code'.
   Its value is /bin/bash


   Documentation:
   *File name to load inferior shells from.
   Initialized from the SHELL environment variable, or to a system-dependent
   default if SHELL is not set.

   You can customize this variable.

Can you explain how this is a bug? In my case it gets its value from
the SHELL environment variable, I haven't customized it inside Emacs.

 As for your patch: it's an improvement because it relies less on the
 shell It could actually avoid the shell altogether now, which would
 avoid quoting problems.

Yes, we discussed that before. However, I feel that is a clean up
with should do after the release (Lennart won't agree with me
though... :)



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-14 Thread Lennart Borgman (gmail)

Mathias Dahl wrote:


Yes, we discussed that before. However, I feel that is a clean up
with should do after the release (Lennart won't agree with me
though... :)



I would say that it is not clean up. It is fixing real bugs.


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-14 Thread Stefan Monnier
 shell-file-name is /bin/bash.
 That's the bug.  `shell-file-name' should be /bin/sh.
 Really? The doc says:

shell-file-name is a variable defined in `C source code'.
Its value is /bin/bash

Documentation:
*File name to load inferior shells from.
Initialized from the SHELL environment variable, or to a system-dependent
default if SHELL is not set.

You can customize this variable.

 Can you explain how this is a bug? In my case it gets its value from
 the SHELL environment variable, I haven't customized it inside Emacs.

Hmm... you're right.  Looks like a more subtle problem than I thought.


Stefan


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-13 Thread Richard Stallman
/bin/sh has only one startup file (/etc/profile and/or ~/.profile) which is
only sourced for login shells, so no that wouldn't explain it.

Bash has other startup files.


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-13 Thread Stefan Monnier
 /bin/sh has only one startup file (/etc/profile and/or ~/.profile)
 which is only sourced for login shells, so no that wouldn't
 explain it.

 Bash has other startup files.

Not when executed as /bin/sh AFAIK (in non-login shells at least).
This is specifically by design for those kinds of reasons we're seeing here.


Stefan


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-13 Thread Mathias Dahl
Stefan Monnier [EMAIL PROTECTED] writes:

 Bash has other startup files.

 Not when executed as /bin/sh AFAIK (in non-login shells at least).
 This is specifically by design for those kinds of reasons we're
 seeing here.

In this particular place we call the command like this:

  (if (not (= 0 (call-process shell-file-name nil nil nil
  shell-command-switch command)))

Also, in this case we came up with a solution where the noclobber
setting was not important, the tool (jpegtran) has a -outfile
parameter that we can use instead of redirection with .

So, is it OK to fix this now?

We are talking about a change from this:

(defcustom tumme-cmd-rotate-original-options
  %p -rotate %d -copy all \%o\  %t
  Format of command used to rotate original image.
Available options are %p which is replaced by
`tumme-cmd-rotate-original-program', %d which is replaced by the
number of (positive) degrees to rotate the image, normally 90 or
270 \(for 90 degrees right and left), %o which is replaced by the
original image file name and %t which is replaced by
`tumme-temp-image-file'.
  :type 'string
  :group 'tumme)


to this:

(defcustom tumme-cmd-rotate-original-options
  %p -rotate %d -copy all -outfile %t \%o\
  Format of command used to rotate original image.
Available options are %p which is replaced by
`tumme-cmd-rotate-original-program', %d which is replaced by the
number of (positive) degrees to rotate the image, normally 90 or
270 \(for 90 degrees right and left), %o which is replaced by the
original image file name and %t which is replaced by
`tumme-temp-image-file'.
  :type 'string
  :group 'tumme)

/Mathias



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-13 Thread Mathias Dahl
Mathias Dahl [EMAIL PROTECTED] writes:

 In this particular place we call the command like this:

   (if (not (= 0 (call-process shell-file-name nil nil nil
   shell-command-switch command)))

Hehe, forgot my point :) What I was trying to say was that in my case
shell-file-name is /bin/bash.

 So, is it OK to fix this now?

I have commited the now :)



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-13 Thread Stefan Monnier
 shell-file-name is /bin/bash.

That's the bug.  `shell-file-name' should be /bin/sh.
As for your patch: it's an improvement because it relies less on the shell
It could actually avoid the shell altogether now, which would avoid
quoting problems.  E.g.:

  %p -rotate %d -copy all -outfile %t \%o\

obviously, this assumes that quoting is done via the \%o\ which
breaks if %o contains .


Stefan


PS: Also if %o assumes the quoting is done in tumme-cmd-rotate-original-options
rather than in %o itself, then I guess that if %d or %p contains metachars
like , , ;, SPC, etc... we may get very funny behavior.  It's probably
not a problem for those because they're under tight control (or it might
even be a desirable feature so that %p can expand to a command with some
args).


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread Mathias Dahl
[EMAIL PROTECTED] writes:

 The command that generated this: jpegtran -rotate 90 -copy all
 file.jpg  ~/.emacs.d/tumme/.tumme_rotate_temp

 The problem is that the  fails if the file already exists.

 So I made a change to tumme-rotate-original that checks if that
 file is there and deletes it before running the current rotate
 command.

Really strange. I rotate images all the time with tumme and I have
never seen this problem. Normally  has no problem overwriting old
files.

If you from the shell do

 $ echo blabla  ~/.emacs.d/tumme/.tumme_rotate_temp

does it work?

Did you also try the jpegtran command line manually, in the shell?

 Here is a patch:

 *** tumme.el.~1~  Thu Aug 24 15:12:48 2006
 --- tumme.el  Thu Jan 11 13:57:41 2007
 ***
 *** 1886,1889 
 --- 1886,1891 
 (if (not (string-match \.[jJ][pP[eE]?[gG]$ file))
 (error Only JPEG images can be rotated!))
 +   (if (file-exists-p tumme-temp-rotate-image-file)
 +   (delete-file tumme-temp-rotate-image-file))
 (setq command (format-spec
tumme-cmd-rotate-original-options


Thanks!

However, I would like to understand why this fails before applying that patch
(which on my system is not needed). Not that the patch is dangerous in
any way, but it is always good to keep the code as small as possible.

Does anyone have an idea?



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread Nick Roberts
   The problem is that the  fails if the file already exists.
  
   So I made a change to tumme-rotate-original that checks if that
   file is there and deletes it before running the current rotate
   command.
  
  Really strange. I rotate images all the time with tumme and I have
  never seen this problem. Normally  has no problem overwriting old
  files.

twurgl probably uses a csh variant and has set noclobber while you don't.

-- 
Nick   http://www.inet.net.nz/~nickrob


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread Mathias Dahl
Nick Roberts [EMAIL PROTECTED] writes:

   Really strange. I rotate images all the time with tumme and I
   have never seen this problem. Normally  has no problem
   overwriting old files.

 twurgl probably uses a csh variant and has set noclobber while you
 don't.

In that case, applying this patch seems to be a good idea.



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread twurgl
echo junkme  ~/.emacs.d/tumme/.tumme_rotate_temp  when that file already 
exists fails for me.
and I discovered the problem when I ran the jpegtran command on the 
command-line, ie it fails too.

I use tcsh and if I run set on the command-line, I see noclobber is listed.  
It must be set by default, I don't set it myself.
So I'd like to see the patch (or whatever other fix you might have) installed.

thanks
tom




  
 Mathias Dahl [EMAIL PROTECTED]   
   
 Sent by:   
  
 emacs-pretest-bug-bounces+twurgl=goodyear  
   To 
 [EMAIL PROTECTED]  
emacs-pretest-bug@gnu.org  

   cc 

  
 01/12/2007 07:34 AM
  Subject 
   Re: problem with 
tumme.el  

  

  

  

  

  

  




Nick Roberts [EMAIL PROTECTED] writes:

   Really strange. I rotate images all the time with tumme and I
   have never seen this problem. Normally  has no problem
   overwriting old files.

 twurgl probably uses a csh variant and has set noclobber while you
 don't.

In that case, applying this patch seems to be a good idea.



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug




___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread Stefan Monnier
  The problem is that the  fails if the file already exists.
 
  So I made a change to tumme-rotate-original that checks if that
  file is there and deletes it before running the current rotate
  command.
 
 Really strange. I rotate images all the time with tumme and I have
 never seen this problem. Normally  has no problem overwriting old
 files.

 twurgl probably uses a csh variant and has set noclobber while you don't.

But tumme should not be using the user's login shell (especially since it
may be anything, including Emacs).  It should use /bin/sh regardless.  So it
doesn't really explain it.


Stefan


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread Chris Moore
Stefan Monnier [EMAIL PROTECTED] writes:

 But tumme should not be using the user's login shell (especially since it
 may be anything, including Emacs).  It should use /bin/sh regardless.  So it
 doesn't really explain it.

Would having 'set -o noclobber' in one of /bin/sh's startup files
explain it?

  (debian) [EMAIL PROTECTED]:/tmp$ /bin/sh
  sh-3.1$ set -o noclobber
  sh-3.1$ date  /tmp/foo
  sh-3.1$ date  /tmp/foo
  sh: /tmp/foo: cannot overwrite existing file


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread Stefan Monnier
 But tumme should not be using the user's login shell (especially since it
 may be anything, including Emacs).  It should use /bin/sh regardless.  So it
 doesn't really explain it.

 Would having 'set -o noclobber' in one of /bin/sh's startup files
 explain it?

/bin/sh has only one startup file (/etc/profile and/or ~/.profile) which is
only sourced for login shells, so no that wouldn't explain it.


Stefan


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread Mathias Dahl

 Would having 'set -o noclobber' in one of /bin/sh's startup files
 explain it?

/bin/sh has only one startup file (/etc/profile and/or ~/.profile) which is
only sourced for login shells, so no that wouldn't explain it.


I see now that jpegtran has an option, -outfile:

 -outfile name
 Send output image to the named file, not to standard output.

That should solve the problem, right?


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread twurgl
I tried the -outfile ~/.emacs.d/tumme/.tumme_rotate_temp from the command line; 
it works great.
It overwrites the old outfile.

thanks





  
 Mathias Dahl [EMAIL PROTECTED] 
 
 Sent by:   
  
 emacs-pretest-bug-bounces+twurgl=goodyear  
   To 
 [EMAIL PROTECTED]  Stefan 
Monnier [EMAIL PROTECTED]

   cc 
   
emacs-pretest-bug@gnu.org  
 01/12/2007 12:10 PM
  Subject 
   Re: problem with 
tumme.el  

  

  

  

  

  

  




  Would having 'set -o noclobber' in one of /bin/sh's startup files
  explain it?

 /bin/sh has only one startup file (/etc/profile and/or ~/.profile) which is
 only sourced for login shells, so no that wouldn't explain it.

I see now that jpegtran has an option, -outfile:

  -outfile name
  Send output image to the named file, not to standard output.

That should solve the problem, right?


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug




___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: problem with tumme.el

2007-01-12 Thread Mathias Dahl

I tried the -outfile ~/.emacs.d/tumme/.tumme_rotate_temp from the command line; 
it works great.
It overwrites the old outfile.


Is it OK to commit a fix for this now?


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug