monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Please review nvm.man-page


From: Thomas Keller
Subject: Re: [Monotone-devel] Please review nvm.man-page
Date: Sat, 21 Aug 2010 00:59:33 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6

Am 19.08.10 19:22, schrieb Stephen Leake:
> Thomas Keller <address@hidden> writes:
> 
>> Am 19.08.2010 14:05, schrieb Stephen Leake:
>>> Thomas Keller <address@hidden> writes:
>>>
>>>> Please have a final look at nvm.man-page. 
>>>
>>> Compilation fails because 'isatty' is not defined in Windows MinGW.
>>>
>>> Neither is troff or less, on a typical MinGW system.
>>
>> Weird, we use isatty in win32/terminal.cc - 
> 
> Ah. I guess I didn't look hard enough.
> 
>> could you test and see if this fixes the issue for you?
>>
>> #
>> # old_revision [64367890e4f081f62c6495359dc74ded12d33a13]
>> #
>> # patch "cmd.cc"
>> #  from [b0c21243f7f344006c05aebb2b4f5c9f9ee6ccfd]
>> #    to [581f15da8b3300ba057c6ed006dde65a84be679b]
>> #
>> ============================================================
>> --- cmd.cc      b0c21243f7f344006c05aebb2b4f5c9f9ee6ccfd
>> +++ cmd.cc      581f15da8b3300ba057c6ed006dde65a84be679b
>> @@ -24,6 +24,7 @@
>>  #ifndef _WIN32
>>  #include <signal.h>
>>  #include <errno.h>
>> +#include <io.h>
>>  #endif
>>
>>  #include <iostream>
> 
> Not quite; that's 'ifndef _WIN32'; we need 'ifdef WIN32'. Then it
> compiles. 

Of course, stupid me, I completly oversaw the "n" in "#ifndef", sorry :)

> In bash under emacs, 'isatty' is apparently false, as this outputs the
> nroff source. So we need an option to force the interactive behavior.

This has been implemented. The option is called "--formatted".

> In a Cygwin window, it gives the same complaint about not finding nroff
> (more in other thread). 
> 
>>> Another solution is to dump a plain text version of the man page by
>>> default, and the formatted version when a new option --formatted is
>>> given; the Makefile will use the option. We could reuse the existing
>>> option --non-interactive for this.
>>
>> The reason why the "manpage" command is not hidden and has this
>> interactivity functionality at all is that you cannot create localized
>> man pages on build time, since you cannot enforce which message
>> catalogue should be used unless the application is installed. So I
>> thought it might be a good idea to install the plain text english one
>> (available via `man mtn`) and have the localized one when `mtn manpage`
>> is called.
> 
> Ah, that makes sense. 
> 
> That should go in monotone.texi (which doesn't have manpage yet?).

I documented the command now, but left out the nitty gritty details why
we don't install localized man pages by default.

>>> At the very least, there needs to be an option to override the default
>>> interactive behavior, so we can generate the troff source from a command
>>> line (for including user commands, for example).
>>
>> User commands are already included, as they're part of the overall
>> command tree. 
> 
> Not in the installed manpage.

Correct and actually I don't plan to enable that in the Makefile either.
The possible negative side effects are rather big, f.e. a packager could
accidentially build the package in an environment where mtn detects
custom lua commands and inserts these into a static man page which is
then shipped...

>> This is btw. another reason for `mtn manpage` which is told to ignore
>> any user commands specifically on build time via --norc since they are
>> of course only locally available and subject to change. 
> 
> But some systems (like mine at work) will have system wide user
> commands, and they will want to install the manpage for them. So there
> needs to be a simple way to do that.

You have to have some way to distribute the custom commands additionally
with the binaries already, I'd propose you generate such a "enriched"
man page yourself and distribute that together with the rest.

>> Using the command from scripts is also not a problem because as soon
>> as STDOUT is not a tty, the plain troff output is echoed anyways, so I
>> see no reason why there should be an option for that.
> 
> That's a magic behavior that would better be explicit.
> 
> For example, if I'm testing a shell script by executing commands
> directly in a bash shell, I need the same behavior.

--plain is btw. the negation of --formatted and now does what you want.

>>> If people don't have privs to install the man page, they can view it
>>> this way:
>>>
>>> mtn man > mtn.1; MANPAGE=.:$MANPAGE man mtn
>>>
>>> This could go in the manual.
>>
>> This and the originally anticipated `mtn man | nroff -man -Tutf8 | less
>> -R` is a bit cumbersome and exactly the reason why I build this
>> interactivity into the command at all. I was kind of inspired of what
>> happens when you e.g. call `git add --help`.
> 
> Now that 'isatty' is not a problem, I don't really have a problem with
> this interactive feature.
> 
> But since it is not reliable on Windows, there needs to be a clear
> mechanism for producing and using the localized manpage (both for LANG
> and for user commands).
> 
> And it would be nice if the error message didn't talk about bugs in
> monotone, since it's not.

Its quite strange that the I() fires on mingw, because popen should
really return NULL if the pipe cannot be created. Can you debug into
this and examine the value of the fp pointer after the call? Thanks!

Thomas.

-- 
GPG-Key 0x160D1092 | address@hidden | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=en

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]