darcs

Issue 770 catch 'does not exist' when running external programs

Title catch 'does not exist' when running external programs
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List E.Y.Kow, darcs-devel, dmitry.kurochkin, eivuokko, hoijarvi, jaredj, kowey, techtonik, thorkilnaur, tommy, wglozer
Assigned To
Topics ProbablyEasy, Windows

Created on 2008-03-30.13:57:13 by techtonik, last changed 2009-08-27.14:01:46 by admin.

Messages
msg4108 (view) Author: techtonik Date: 2008-03-30.13:57:11
On windows command "p: view this patch in full with pager" fails. "darcs.exe:
less: runProcess: does not exist (No such file or directory)"

Command that is "less" alternative on windows is called "more".
msg4111 (view) Author: droundy Date: 2008-03-31.13:42:23
You can define the PAGER environment variable to be more, and things should work
fine.
msg4142 (view) Author: techtonik Date: 2008-03-31.16:14:33
Thanks for the hint, but I hope this is not user support tracker and some steps
will be taken to avoid this situation in future versions. =)
msg4144 (view) Author: droundy Date: 2008-03-31.16:18:22
On Mon, Mar 31, 2008 at 04:14:35PM -0000, techtonik wrote:
> Thanks for the hint, but I hope this is not user support tracker and some steps
> will be taken to avoid this situation in future versions. =)

Me too.

David
msg4345 (view) Author: kowey Date: 2008-04-25.17:36:47
I'm marking this as a bug.

The view_file function, which is used by darcs to pipe patches through a pager
(Darcs.PrintPatch.printPatchPager), looks like this:

view_file :: String -> IO ExitCode
view_file f = do
  viewer <- get_viewer
  exec_interactive viewer f
             `ortryrunning` exec_interactive "less" f
             `ortryrunning` exec_interactive "more" f

which makes me think that it should at try "more" if "less" is not found.  Why
is this not actually happening?
msg4552 (view) Author: kowey Date: 2008-05-07.14:58:00
From issue784 , David's proposed solution is to default to printing-on-screen if
no pager is found.  This definitely sounds like a sensible alternative, so we
should implement that.

On the other hand, it would also be really good if we figured out why defaulting
to 'more' does not actually work...
msg4572 (view) Author: hoijarvi Date: 2008-05-08.19:34:51
There's more to that.

I use restricted account for all developing for security reasons. Therefore, I
cannot create a file at C:\

C:\>darcs --help
darcs version 2.0.0 (2.0.0 (+ 19 patches))
darcs.exe: openFd: permission denied (Permission denied)

darcs attempts to create a temporary file for paging into this directory. The
same probably happens with repository in CD-ROM or read only network drive?

In windows:
- temp dir is defined and should be respected
- more is more.com, not more.exe, which might have something to do with process
creation.
msg4573 (view) Author: kowey Date: 2008-05-08.22:09:32
hoijarvi: thanks!

Just noting for future reference that there are two mechanisms for passing
things through a pager: Darcs.External.viewDoc and Darcs.Utils.view_file

The former already defaults to printing on stdout; the latter does not.

The former is used for paging the --help output; the latter for printing patches
(I think)

And because the former uses pipeDoc, it attempts to create a temporary file. 
Now glancing at the temp file creation behaviour again.

In the meantime, you could try setting DARCS_TEMP
msg4574 (view) Author: kowey Date: 2008-05-08.22:17:19
Note: the environment variable in question is DARCS_TMPDIR, but I get the
impression it won't have the intended effect.
msg4597 (view) Author: kowey Date: 2008-05-09.12:13:34
Kari: thanks for your comments.  I see you have successfully experimented with
copying more.com to less.exe.  Could you run one more experiment for us; could
you run delete your less.exe (check that darcs fails) and then copy your
more.com to more.exe?

Thanks!
msg4603 (view) Author: hoijarvi Date: 2008-05-09.14:02:06
You're welcome.

more.exe did not work, it has to be less.exe. Capitalization did not 
matter, in windows it should not but I tested just in case.

In a related note:

Eric Kow wrote:
> Wait a second, I don't think this is a duplicate.  Is there any reason to
> believe that the diff-command stuff has anything to do with the pager?  I doubt it.
>
> ----------
> nosy: +eivuokko, jaredj, rgm, wglozer
> status: duplicate -> chatting
> title: if calling a pager fails, just print to stdout without a pager -> diff --diff-command => darcs: darcs84bdba: removeFile: permission denied (Permission denied)
> topic: +Windows
>   

My first though it that this is a pager issue. Somebody should test this 
under windows after making less.exe

Kari
msg4626 (view) Author: kowey Date: 2008-05-11.11:36:17
Ok Kari, we've fixed the permissions and tmpdir issue, but we still need to
figure out what to do about the does-not-exist problem.  For what it's worth,
this works fine under Linux and MacOS X (we get an exit 127 which we catch), but
I'm guessing that under Windows, an exception is thrown which we also need to catch.

I can run Windows under Parallels, but it's a bit of pain.  Any Windows-using
Haskellers want to take this on?
msg4974 (view) Author: E.Y.Kow Date: 2008-06-05.13:55:06
The following patch updated the status of issue770 to be resolved:

* resolve issue770: catch 'does not exist' when running external programs 
Convert these errors into ExitCode 127 (for Windows)
History
Date User Action Args
2008-03-30 13:57:13techtonikcreate
2008-03-31 13:42:25droundysetstatus: unread -> unknown
nosy: + droundy
messages: + msg4111
2008-03-31 16:14:35techtoniksetnosy: droundy, tommy, beschmi, kowey, techtonik
messages: + msg4142
2008-03-31 16:18:23droundysetnosy: droundy, tommy, beschmi, kowey, techtonik
messages: + msg4144
2008-03-31 16:20:28droundysetnosy: - droundy
2008-03-31 16:20:41droundysetpriority: bug -> feature
nosy: tommy, beschmi, kowey, techtonik
2008-04-25 17:36:49koweysetpriority: feature -> bug
nosy: tommy, beschmi, kowey, techtonik
messages: + msg4345
2008-05-07 14:56:32koweylinkissue784 superseder
2008-05-07 14:58:03koweysetnosy: + dagit
messages: + msg4552
title: win: pagination doesn't work - no "less" command -> if calling a pager fails, just print to stdout without a pager
2008-05-08 19:34:52hoijarvisetnosy: + hoijarvi
messages: + msg4572
2008-05-08 22:09:34koweysetnosy: tommy, beschmi, kowey, dagit, techtonik, hoijarvi
messages: + msg4573
2008-05-08 22:17:21koweysetnosy: tommy, beschmi, kowey, dagit, techtonik, hoijarvi
messages: + msg4574
2008-05-09 12:13:36koweysetnosy: tommy, beschmi, kowey, dagit, techtonik, hoijarvi
messages: + msg4597
2008-05-09 14:02:08hoijarvisetnosy: tommy, beschmi, kowey, dagit, techtonik, hoijarvi
messages: + msg4603
2008-05-11 11:36:22koweysetstatus: unknown -> has-patch
nosy: + wglozer, eivuokko, rgm, jaredj
topic: + Windows, ProbablyEasy
messages: + msg4626
title: if calling a pager fails, just print to stdout without a pager -> Windows: pager => less: runProcess: does not exist (No such file or directory)
2008-05-11 11:37:37koweysetnosy: tommy, beschmi, kowey, wglozer, eivuokko, dagit, rgm, jaredj, techtonik, hoijarvi
title: Windows: pager => less: runProcess: does not exist (No such file or directory) -> pager => less: runProcess: does not exist (No such file or directory) (2.0.0 Windows)
2008-05-14 18:50:22koweylinkissue783 superseder
2008-05-21 11:28:20rgmsetnosy: - rgm
2008-05-23 10:19:44koweylinkissue875 superseder
2008-06-05 13:55:09E.Y.Kowsetstatus: has-patch -> resolved-in-unstable
nosy: + E.Y.Kow
messages: + msg4974
title: pager => less: runProcess: does not exist (No such file or directory) (2.0.0 Windows) -> catch 'does not exist' when running external programs
2008-08-05 23:27:09koweysetstatus: resolved-in-unstable -> resolved
nosy: tommy, beschmi, kowey, wglozer, eivuokko, dagit, jaredj, E.Y.Kow, techtonik, hoijarvi
2009-08-06 18:23:14adminsetnosy: + dmitry.kurochkin, simon, thorkilnaur, - wglozer, eivuokko, jaredj, E.Y.Kow, techtonik, hoijarvi
2009-08-06 21:01:24adminsetnosy: - beschmi
2009-08-10 22:18:57adminsetnosy: + wglozer, E.Y.Kow, eivuokko, techtonik, hoijarvi, jaredj
2009-08-11 00:09:17adminsetnosy: - dagit
2009-08-25 18:09:28adminsetnosy: + darcs-devel, - simon
2009-08-27 14:01:46adminsetnosy: tommy, kowey, wglozer, darcs-devel, eivuokko, thorkilnaur, jaredj, dmitry.kurochkin, E.Y.Kow, techtonik, hoijarvi
2009-09-04 08:51:28koweyunlinkissue875 superseder