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

2010-08-20 Thread Stephen Leake
Thomas Keller  writes:

>> 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".

Excellent. And another use for CMD_PRESET_OPTIONS :).

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

looks good.

>> 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!

I tried, but the behavior is totally different under gdb; nothing is
displayed, but no error messages are printed.

Falling back on 'printf' as a debug tool, the fprintf call is returning
-1, indicating some error. On the other hand, errno is 0, which isn't
much help. And the text got printed (saying nroff not found).

So this is just more evidence of a buggy popen on MinGW.

I suggest we leave out the I(). fprintf failing is _not_ a monotone bug;
it's an OS or user problem. I don't see how an I() message would be
helpful. 

It might be better to disable --formatted on WIN32.

-- 
-- Stephe

___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


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

2010-08-20 Thread Thomas Keller
Am 19.08.10 19:22, schrieb Stephen Leake:
> Thomas Keller  writes:
> 
>> Am 19.08.2010 14:05, schrieb Stephen Leake:
>>> Thomas Keller  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 
>>  #include 
>> +#include 
>>  #endif
>>
>>  #include 
> 
> 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

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

2010-08-20 Thread Thomas Keller
Am 20.08.10 23:56, schrieb Thomas Moschny:
> Thomas Keller :
> 
>> Comments are welcome.
> 
> Most things have already been said by others. 
> 
> * I'd like to see the section headings in the generated man page to be
>   localized, too.

Oh, they are localized already - just that they haven't yet been
translated :)

> * in 'interactive' mode, nroff is called with -Tutf8, but not all
>   locales use utf-8, so this should instead be locale-dependent.

This is another issue I stumbled upon today, because my groff
installation at work (opensuse 11.3) is still on 1.18.1.1 and this
version seems to have major utf8 problems. And while 1.20.1 which seems
to fix these problems (at least MacPorts has 1.20.1 and everything works
for me) is out since January 2009, only very few distributions actually
updated since then.

The problem with 1.18.1.1 seems to be that while you tell him to process
the input as utf8, it will display the raw utf8 bytes in utf8 mode. Only
latin1 seems to work (i.e. set LANG=de_DE.ISO-8859-1). I already looked
for groff alternatives, but only found the heirloom project which comes
with its own, apparently utf8-capable incarnation of nroff, but that
doesn't seem to be packaged anywhere.

Anyways, I read up on the nroff man page and apparently the proper type
is looked for automatically based on the output of locale(1), LC_ALL,
LC_CTYPE and LANG, so indeed there is no need to set it to utf8 by hand.

Thomas.

-- 
GPG-Key 0x160D1092 | tommyd3...@jabber.ccc.de | 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



signature.asc
Description: OpenPGP digital signature
___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


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

2010-08-20 Thread Thomas Moschny
Thomas Keller :

> Comments are welcome.

Most things have already been said by others. 

* I'd like to see the section headings in the generated man page to be
  localized, too.
* in 'interactive' mode, nroff is called with -Tutf8, but not all
  locales use utf-8, so this should instead be locale-dependent.

- Thomas

___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


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

2010-08-20 Thread Stephen Leake
Thomas Keller  writes:

> Am 19.08.2010 14:14, schrieb Stephen Leake:
>> Stephen Leake  writes:
>> 
>>> For MinGW testing, I commented out the isatty check, so it always dumps
>>> the troff source. The tests/manpage test passes.
>>>
>>> Reading the output with 'man mtn' in a Cygwin bash shell works, and with
>>> 'M-x man mtn' in Emacs.
>> 
>> As another test, I commented out the 'isatty' check, but made it always
>> run the interactive command. Running in a Cygwin shell with nroff and
>> less in path, that gave:
>> 
>> bash-3.2$ ./mtn man
>> 'nroff' is not recognized as an internal or external command,
>> operable program or batch file.
>> mtn: fatal: error: ../monotone.man-page/cmd.cc:927: I(fprintf(fp, 
>> ss.str().c_str()) != -1)
>> mtn: this is almost certainly a bug in monotone.
>
> Interesting, I thought popen uses the same environment like the calling
> process, apparently this is not true here. Could you try to change the
> command for the hook "get_man_page_formatter_command" like this?
>
>PATH=... nroff -man -Tutf8 | less -R
>
> and set ... to the needed path specification?

Didn't help. Apparently popen is just broken in MinGW.

In Cygwin bash under Emacs, running MinGW mtn, this works:

./mtn man | nroff -man -Tutf8 | less -R

(I'm not clear what changed from my previous test where this failed;
probably something in my PATH)

I put that in a shell script (so isatty is false), and it works nicely
in a Cygwin bash window.

-- 
-- Stephe

___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


[Monotone-devel] [bug #30655] Branch-name globbing syntax doesn't work correctly

2010-08-20 Thread Thomas Keller

Update of bug #30655 (project monotone):

  Status:None => Fixed  
 Open/Closed:Open => Closed 

___

Follow-up Comment #2:

Fixed in 1217dbba9ab3b6bf90c8210e733ea883b5adbe0b - thanks Tim!

___

Reply to this item at:

  

___
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel