all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* gunzip problem on Windows
@ 2009-11-04 16:32 Xah Lee
  2009-11-04 17:34 ` Andreas Politz
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Xah Lee @ 2009-11-04 16:32 UTC (permalink / raw
  To: help-gnu-emacs

when using emacs on Windows, when in dired, when i press Z on a file
that's gzip compressed, emacs tells me:
'gunzip' is not recognized as an internal or external command,

the problem is apparently that emacs won't recognize the gunzip shell
script without the exe suffix. (the gunzip is in the same dir as
gzip.exe) But if i rename gunzip to gunzip.exe, but Windows complain
that the file is not a exe format.

How to solve this problem?

extra detail:

when i do
(executable-find "gzip")
emacs says
"c:/cygwin/bin/gzip.exe"

and
(executable-find "gunzip")
says
nil.

the gunzip exists at
c:/cygwin/bin/gunzip
which is a shell script.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: gunzip problem on Windows
  2009-11-04 16:32 gunzip problem on Windows Xah Lee
@ 2009-11-04 17:34 ` Andreas Politz
  2009-11-04 17:56 ` Eli Zaretskii
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Andreas Politz @ 2009-11-04 17:34 UTC (permalink / raw
  To: help-gnu-emacs

Xah Lee <xahlee@gmail.com> writes:

> when using emacs on Windows, when in dired, when i press Z on a file
> that's gzip compressed, emacs tells me:
> 'gunzip' is not recognized as an internal or external command,
>
> the problem is apparently that emacs won't recognize the gunzip shell
> script without the exe suffix. (the gunzip is in the same dir as
> gzip.exe) But if i rename gunzip to gunzip.exe, but Windows complain
> that the file is not a exe format.
>
> How to solve this problem?

Maybe install a bourne shell.

$ cat gunzip

#!/bin/sh
PATH=${GZIP_BINDIR-'/bin'}:$PATH
exec gzip -d "$@"

-ap





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

* Re: gunzip problem on Windows
  2009-11-04 16:32 gunzip problem on Windows Xah Lee
  2009-11-04 17:34 ` Andreas Politz
@ 2009-11-04 17:56 ` Eli Zaretskii
  2009-11-05 14:26   ` Kevin Rodgers
       [not found]   ` <mailman.10126.1257431414.2239.help-gnu-emacs@gnu.org>
  2009-11-05 13:22 ` Friedrich Dominicus
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2009-11-04 17:56 UTC (permalink / raw
  To: help-gnu-emacs

> From: Xah Lee <xahlee@gmail.com>
> Date: Wed, 4 Nov 2009 08:32:36 -0800 (PST)
> 
> when using emacs on Windows, when in dired, when i press Z on a file
> that's gzip compressed, emacs tells me:
> 'gunzip' is not recognized as an internal or external command,
> 
> the problem is apparently that emacs won't recognize the gunzip shell
> script without the exe suffix. (the gunzip is in the same dir as
> gzip.exe) But if i rename gunzip to gunzip.exe, but Windows complain
> that the file is not a exe format.
> 
> How to solve this problem?

It might work to copy gzip.exe into gunzip.exe.

Failing that, create a batch file gunzip.bat that does the same as the
shell script gunzip, and put it somewhere on your Path.




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

* Re: gunzip problem on Windows
  2009-11-04 16:32 gunzip problem on Windows Xah Lee
  2009-11-04 17:34 ` Andreas Politz
  2009-11-04 17:56 ` Eli Zaretskii
@ 2009-11-05 13:22 ` Friedrich Dominicus
  2009-11-05 19:37   ` Xah Lee
  2009-11-05 19:34 ` Xah Lee
       [not found] ` <mailman.10068.1257357458.2239.help-gnu-emacs@gnu.org>
  4 siblings, 1 reply; 14+ messages in thread
From: Friedrich Dominicus @ 2009-11-05 13:22 UTC (permalink / raw
  To: help-gnu-emacs

Xah Lee <xahlee@gmail.com> writes:

> and
> (executable-find "gunzip")
> says
> nil.
>
> the gunzip exists at
> c:/cygwin/bin/gunzip
> which is a shell script.
Just change the 
dired-compress-file-suffixes
variable. Instead of gunzip you can use gzip -d

Regards
Friedrich

-- 
Please remove just-for-news- to reply via e-mail.


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

* Re: gunzip problem on Windows
  2009-11-04 17:56 ` Eli Zaretskii
@ 2009-11-05 14:26   ` Kevin Rodgers
  2009-11-05 19:06     ` Eli Zaretskii
       [not found]     ` <mailman.10136.1257448020.2239.help-gnu-emacs@gnu.org>
       [not found]   ` <mailman.10126.1257431414.2239.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 14+ messages in thread
From: Kevin Rodgers @ 2009-11-05 14:26 UTC (permalink / raw
  To: help-gnu-emacs

Eli Zaretskii wrote:
>> From: Xah Lee <xahlee@gmail.com>
>> Date: Wed, 4 Nov 2009 08:32:36 -0800 (PST)
>>
>> when using emacs on Windows, when in dired, when i press Z on a file
>> that's gzip compressed, emacs tells me:
>> 'gunzip' is not recognized as an internal or external command,
>>
>> the problem is apparently that emacs won't recognize the gunzip shell
>> script without the exe suffix. (the gunzip is in the same dir as
>> gzip.exe) But if i rename gunzip to gunzip.exe, but Windows complain
>> that the file is not a exe format.
>>
>> How to solve this problem?
> 
> It might work to copy gzip.exe into gunzip.exe.
> 
> Failing that, create a batch file gunzip.bat that does the same as the
> shell script gunzip, and put it somewhere on your Path.

Why not just rename the existing gunzip script to gunzip.bat?

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* Re: gunzip problem on Windows
  2009-11-05 14:26   ` Kevin Rodgers
@ 2009-11-05 19:06     ` Eli Zaretskii
       [not found]     ` <mailman.10136.1257448020.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2009-11-05 19:06 UTC (permalink / raw
  To: help-gnu-emacs

> From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
> Date: Thu, 05 Nov 2009 07:26:07 -0700
> 
> > It might work to copy gzip.exe into gunzip.exe.
> > 
> > Failing that, create a batch file gunzip.bat that does the same as the
> > shell script gunzip, and put it somewhere on your Path.
> 
> Why not just rename the existing gunzip script to gunzip.bat?

Because Unixy shell scripts and Windows batch files have different
syntax for how they invoke commands.  For example, a typical Unix
shell script will have a "#! /bin/sh" line as its first line; the
Windows command processor will choke on such a line.




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

* Re: gunzip problem on Windows
  2009-11-04 16:32 gunzip problem on Windows Xah Lee
                   ` (2 preceding siblings ...)
  2009-11-05 13:22 ` Friedrich Dominicus
@ 2009-11-05 19:34 ` Xah Lee
  2009-11-05 20:23   ` Xah Lee
       [not found] ` <mailman.10068.1257357458.2239.help-gnu-emacs@gnu.org>
  4 siblings, 1 reply; 14+ messages in thread
From: Xah Lee @ 2009-11-05 19:34 UTC (permalink / raw
  To: help-gnu-emacs

So far, i haven't been able to get this to work, after taking in all
the suggestions in this thread.

Here's a more full report.

Suppose in dired you have a a file named x.txt.gz, and you move your
cursor to it, then press Z. Emacs will ask you “Compress or uncompress
x.txt.gz? (y or n)”. Answer y should uncompress the file, as the
expected behavior.

I have “gunzip” installed by cygwin at “C:\cygwin\bin”. In emacs, when
you do a “shell-command” then “which gunzip”, the output is “/usr/bin/
gunzip”. This means, emacs can find the file.

The content of that file is:
«
#!/bin/sh
PATH=${GZIP_BINDIR-'/usr/bin'}:$PATH
exec gzip -d "$@"
»

Here's the problem. When i do Z, i get this error:
“apply: Searching for program: no such file or directory, gunzip”.

This is odd and shouldn't happen, since the file is right there and
emacs can find the file by “which gunzip”.

if i rename the file to gunzip.bat, then i do Z in dired on the file,
i get this error:

«
c:\Users\xah\web\xahlee_org\emacs>#!/bin/sh
'#!' is not recognized as an internal or external command,
operable program or batch file.

c:\Users\xah\web\xahlee_org\emacs>PATH=${GZIP_BINDIR-'/usr/bin'}:
$PATH

c:\Users\xah\web\xahlee_org\emacs>exec gzip -d "$@"
'exec' is not recognized as an internal or external command,
operable program or batch file.
Failed to compressc:/Users/xah/web/xahlee_org/emacs/xxxx.txt.gz
»

So, apparantly, emacs can find the program now, but for some mixed
reasons of Windows cmd.exe and cygwin bash and emacs, it seems to run
it as win cmd.exe script and not bash. I suppose this is expected
behavior.

if i rename the file to gunzip.sh, i get this error:

«apply: Searching for program: no such file or directory, gunzip»

the value of my exec-suffixes is
(".exe" ".com" ".bat" ".cmd" ".btm" "")
after changing it to
(".exe" ".com" ".bat" ".cmd" ".btm" ".sh" "")

still same error.

Renaming the file to gunzip.exe wont work because .exe files needs to
be in certain format.

Note that also even if renaming to gunzip.bat or gunzip.sh worked for
this emacs usage situation, that probably isn't a good solution
because it will probably break cygwin, since in unix shell it is
expected to be just “gunzip” not “gunzip.bat” or “gunzip.sh”. So, if
renaming can work for emacs, possibly i'll just create it else where
and put it in a different path...

am i missing something?

does Z in dired on a compressed file work for anyone in Windows?

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: gunzip problem on Windows
       [not found] ` <mailman.10068.1257357458.2239.help-gnu-emacs@gnu.org>
@ 2009-11-05 19:35   ` Xah Lee
  0 siblings, 0 replies; 14+ messages in thread
From: Xah Lee @ 2009-11-05 19:35 UTC (permalink / raw
  To: help-gnu-emacs

On Nov 4, 9:56 am, Eli Zaretskii <e...@gnu.org> wrote:
> > From: Xah Lee <xah...@gmail.com>
> > Date: Wed, 4 Nov 2009 08:32:36 -0800 (PST)
>
> > when using emacs on Windows, when in dired, when i press Z on a file
> > that's gzip compressed, emacs tells me:
> > 'gunzip' is not recognized as an internal or external command,
>
> > the problem is apparently that emacs won't recognize the gunzip shell
> > script without the exe suffix. (the gunzip is in the same dir as
> > gzip.exe) But if i rename gunzip to gunzip.exe, but Windows complain
> > that the file is not a exe format.
>
> > How to solve this problem?
>
> It might work to copy gzip.exe into gunzip.exe.
>
> Failing that, create a batch file gunzip.bat that does the same as the
> shell script gunzip, and put it somewhere on your Path.

can you show the .bat syntax that does the same as bash?
am not familiar with cmd.exe much. Thanks.

 Xah


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

* Re: gunzip problem on Windows
  2009-11-05 13:22 ` Friedrich Dominicus
@ 2009-11-05 19:37   ` Xah Lee
  0 siblings, 0 replies; 14+ messages in thread
From: Xah Lee @ 2009-11-05 19:37 UTC (permalink / raw
  To: help-gnu-emacs

On Nov 5, 5:22 am, Friedrich Dominicus <just-for-news-fr...@q-software-
solutions.de> wrote:
> Xah Lee <xah...@gmail.com> writes:
> > and
> > (executable-find "gunzip")
> > says
> > nil.
>
> > the gunzip exists at
> > c:/cygwin/bin/gunzip
> > which is a shell script.
>
> Just change the
> dired-compress-file-suffixes
> variable. Instead of gunzip you can use gzip -d
>
> Regards
> Friedrich

as far as i know, you can put a program name in dired-compress-file-
suffiexes, but not a program name with a option parameter. How do you
do that?

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: gunzip problem on Windows
       [not found]   ` <mailman.10126.1257431414.2239.help-gnu-emacs@gnu.org>
@ 2009-11-05 19:38     ` Xah Lee
  0 siblings, 0 replies; 14+ messages in thread
From: Xah Lee @ 2009-11-05 19:38 UTC (permalink / raw
  To: help-gnu-emacs

On Nov 5, 6:26 am, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> Eli Zaretskii wrote:
> >> From: Xah Lee <xah...@gmail.com>
> >> Date: Wed, 4 Nov 2009 08:32:36 -0800 (PST)
>
> >> when using emacs on Windows, when in dired, when i press Z on a file
> >> that's gzip compressed, emacs tells me:
> >> 'gunzip' is not recognized as an internal or external command,
>
> >> the problem is apparently that emacs won't recognize the gunzip shell
> >> script without the exe suffix. (the gunzip is in the same dir as
> >> gzip.exe) But if i rename gunzip to gunzip.exe, but Windows complain
> >> that the file is not a exe format.
>
> >> How to solve this problem?
>
> > It might work to copy gzip.exe into gunzip.exe.
>
> > Failing that, create a batch file gunzip.bat that does the same as the
> > shell script gunzip, and put it somewhere on your Path.
>
> Why not just rename the existing gunzip script to gunzip.bat?

i tried that... then emacs tries to run the bash script as if it is a
cmb.exe bat file... renaming it to gunzip.sh doesn't work neither...
see my other msg.

 Xah


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

* Re: gunzip problem on Windows
  2009-11-05 19:34 ` Xah Lee
@ 2009-11-05 20:23   ` Xah Lee
  2009-11-06  8:28     ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Xah Lee @ 2009-11-05 20:23 UTC (permalink / raw
  To: help-gnu-emacs

Found a solution. Create a file name gunzip.bat, with this content:

@echo off
gzip -d %1

thanks to Eli and others.

I filed a bug report to FSF on this. #4867. I think this should still
considered a bug though. Considering it as a Windows OS problem isn't
very helpful in solving this. I'm sure if similar problems happens in
linux that's OS issue, people probably will not look at it as “Oh,
it's OS issue, emacs doesn't need to deal with it”.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: gunzip problem on Windows
  2009-11-05 20:23   ` Xah Lee
@ 2009-11-06  8:28     ` Eli Zaretskii
  0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2009-11-06  8:28 UTC (permalink / raw
  To: help-gnu-emacs

> From: Xah Lee <xahlee@gmail.com>
> Date: Thu, 5 Nov 2009 12:23:52 -0800 (PST)
> 
> Found a solution. Create a file name gunzip.bat, with this content:
> 
> @echo off
> gzip -d %1

As I wrote elsewhere, it's better to change %1 to %*, because then the
batch file is not limited to a single argument.

> I filed a bug report to FSF on this. #4867. I think this should still
> considered a bug though. Considering it as a Windows OS problem isn't
> very helpful in solving this.

It's not a Windows problem, and it's not an Emacs problem, either.  A
program running on a certain OS cannot be reasonably expected to run
shell scripts from another OS.  Granted, a motivated volunteer can
step forward and write the code for Emacs to support Unix shell
scripts on Windows (and they will be most welcome), but until then,
this is at best a feature request, not a bug.




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

* Re: gunzip problem on Windows
       [not found]     ` <mailman.10136.1257448020.2239.help-gnu-emacs@gnu.org>
@ 2009-11-10 14:42       ` Sébastien Vauban
  2018-05-01  9:55         ` byron.cordova.mora
  0 siblings, 1 reply; 14+ messages in thread
From: Sébastien Vauban @ 2009-11-10 14:42 UTC (permalink / raw
  To: help-gnu-emacs-mXXj517/zsQ

Eli Zaretskii wrote:
>> From: Kevin Rodgers <kevin.d.rodgers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>>
>>> It might work to copy gzip.exe into gunzip.exe.

Another solution, from the Net (don't know who anymore):

--8<---------------cut here---------------start------------->8---
      (require 'dired-aux)

      (defun dired-call-process (program discard &rest arguments)
        ;; 09Feb02, sailor overwrite this function because Gnu Emacs cannot
        ;; recognize gunzip is a symbolic link to gzip. Thus, if the program
        ;; is "gunzip", replace it with "gzip" and add an option "-d".

        ;; "Run PROGRAM with output to current buffer unless DISCARD is t.
        ;; Remaining arguments are strings passed as command arguments to
        ;; PROGRAM."
        ;; Look for a handler for default-directory in case it is a
        ;; remote file name.
        (let ((handler
               (find-file-name-handler (directory-file-name default-directory)
                                       'dired-call-process)))
          (if handler (apply handler 'dired-call-process
                             program discard arguments)
            (progn
              (if (string-equal program "gunzip")
                  (progn
                    (setq program "gzip")
                    (add-to-list 'arguments "-d")))
              (apply 'call-process program nil (not discard) nil arguments)))))
--8<---------------cut here---------------end--------------->8---

Seb

-- 
Sébastien Vauban


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

* Re: gunzip problem on Windows
  2009-11-10 14:42       ` Sébastien Vauban
@ 2018-05-01  9:55         ` byron.cordova.mora
  0 siblings, 0 replies; 14+ messages in thread
From: byron.cordova.mora @ 2018-05-01  9:55 UTC (permalink / raw
  To: help-gnu-emacs

El martes, 10 de noviembre de 2009, 9:42:52 (UTC-5), Sébastien Vauban  escribió:
> Eli Zaretskii wrote:
> >> From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
> >>>
> >>> It might work to copy gzip.exe into gunzip.exe.
> 
> Another solution, from the Net (don't know who anymore):
> 
> --8<---------------cut here---------------start------------->8---
>       (require 'dired-aux)
> 
>       (defun dired-call-process (program discard &rest arguments)
>         ;; 09Feb02, sailor overwrite this function because Gnu Emacs cannot
>         ;; recognize gunzip is a symbolic link to gzip. Thus, if the program
>         ;; is "gunzip", replace it with "gzip" and add an option "-d".
> 
>         ;; "Run PROGRAM with output to current buffer unless DISCARD is t.
>         ;; Remaining arguments are strings passed as command arguments to
>         ;; PROGRAM."
>         ;; Look for a handler for default-directory in case it is a
>         ;; remote file name.
>         (let ((handler
>                (find-file-name-handler (directory-file-name default-directory)
>                                        'dired-call-process)))
>           (if handler (apply handler 'dired-call-process
>                              program discard arguments)
>             (progn
>               (if (string-equal program "gunzip")
>                   (progn
>                     (setq program "gzip")
>                     (add-to-list 'arguments "-d")))
>               (apply 'call-process program nil (not discard) nil arguments)))))
> --8<---------------cut here---------------end--------------->8---
> 
> Seb
> 
> -- 
> Sébastien Vauban

#otra forma:
#ver donde esta gzip:
where gzip
#por ejemplo, presentaría:
C:\laragon\bin\git\usr\bin\gzip.exe
C:\Program Files\Git\usr\bin\gzip.exe

#ubicarse, por ejemplo: C:\Program Files\Git\usr\bin
#crear archivo: gunzip.bat
#contenido del bat: 
@echo off
gzip -d -f %1
# guardar y salir
# note: es necesario -f para forzar la descompresion


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

end of thread, other threads:[~2018-05-01  9:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 16:32 gunzip problem on Windows Xah Lee
2009-11-04 17:34 ` Andreas Politz
2009-11-04 17:56 ` Eli Zaretskii
2009-11-05 14:26   ` Kevin Rodgers
2009-11-05 19:06     ` Eli Zaretskii
     [not found]     ` <mailman.10136.1257448020.2239.help-gnu-emacs@gnu.org>
2009-11-10 14:42       ` Sébastien Vauban
2018-05-01  9:55         ` byron.cordova.mora
     [not found]   ` <mailman.10126.1257431414.2239.help-gnu-emacs@gnu.org>
2009-11-05 19:38     ` Xah Lee
2009-11-05 13:22 ` Friedrich Dominicus
2009-11-05 19:37   ` Xah Lee
2009-11-05 19:34 ` Xah Lee
2009-11-05 20:23   ` Xah Lee
2009-11-06  8:28     ` Eli Zaretskii
     [not found] ` <mailman.10068.1257357458.2239.help-gnu-emacs@gnu.org>
2009-11-05 19:35   ` Xah Lee

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.