tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Respect MACHINE.
@ 2011-12-14 10:44 Kristaps Dzonsons
  2011-12-14 11:36 ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: Kristaps Dzonsons @ 2011-12-14 10:44 UTC (permalink / raw)
  To: tech

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

Hi,

The enclosed small patch respects the MACHINE variable as stipulated in 
man(1).  This isn't mentioned in apropos(1) or whatis(1), but it makes 
sense to be consistent with man(1)'s environment (MANPATH, etc.).  Thoughts?

Thanks,

Kristaps

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1547 bytes --]

Index: apropos.1
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos.1,v
retrieving revision 1.13
diff -u -r1.13 apropos.1
--- apropos.1	12 Dec 2011 02:00:49 -0000	1.13
+++ apropos.1	14 Dec 2011 10:38:06 -0000
@@ -238,6 +238,10 @@
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width Ds
+.It Ev MACHINE
+Case-insensitive architecture.
+Overriden by
+.Fl S .
 .It Ev MANPATH
 Colon-separated paths overriding the default list of paths searched for
 manual databases.
Index: apropos.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos.c,v
retrieving revision 1.24
diff -u -r1.24 apropos.c
--- apropos.c	12 Dec 2011 02:00:49 -0000	1.24
+++ apropos.c	14 Dec 2011 10:38:06 -0000
@@ -62,6 +62,7 @@
 	auxpaths = defpaths = NULL;
 	conf_file = NULL;
 	e = NULL;
+	opts.arch = getenv("MACHINE");
 
 	while (-1 != (ch = getopt(argc, argv, "C:M:m:S:s:")))
 		switch (ch) {
Index: whatis.1
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/whatis.1,v
retrieving revision 1.4
diff -u -r1.4 whatis.1
--- whatis.1	12 Dec 2011 02:00:49 -0000	1.4
+++ whatis.1	14 Dec 2011 10:38:06 -0000
@@ -110,6 +110,10 @@
 .Dl $ apropos -- -i 'Nm~[[:<:]]term[[:>:]]'
 .Sh ENVIRONMENT
 .Bl -tag -width Ds
+.It Ev MACHINE
+Case-insensitive architecture.
+Overriden by
+.Fl S .
 .It Ev MANPATH
 Colon-separated paths overriding the default list of paths searched for
 manual databases.

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

* Re: Respect MACHINE.
  2011-12-14 10:44 Respect MACHINE Kristaps Dzonsons
@ 2011-12-14 11:36 ` Ingo Schwarze
  2011-12-14 13:08   ` Kristaps Dzonsons
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Schwarze @ 2011-12-14 11:36 UTC (permalink / raw)
  To: tech

Hi Kristaps,

Kristaps Dzonsons wrote on Wed, Dec 14, 2011 at 11:44:31AM +0100:

> The enclosed small patch respects the MACHINE variable

I hate environment variables in general (as opposed to variables
used inside programs, like those in daily(8) and security(8)).
I think looking at them is a bad idea in most cases.
They change behaviour of programs, and as a user,
it is very easy to forget about variables one has set,
and it may even happen that the administrator changes
variables behind one's back (in /etc/profile).

Whenever a program looks at a variable, it should be checked
whether looking at the variable can be removed, and i'm OK with
keeping it only when there are very strong reasons to do so.

Adding new variables is almost never OK with me.

Keeping MANPATH is probably OK because it has been around so
long and many people are probably used to it; removing it would
be likely to cause more confusion than continuing to support it.
But adding to that - no, i hate the idea.

Regarding MACHINE, i believe that variable should not be used at
all except for technical purposes, like in build systems.
It should not affect which documentation i can find!
If i had a VAX, i would certainly often use apropos(1) on i386
or amd64 to search for VAX documentation, just because it's
faster, and i would not want to fiddle with the environment.

> as stipulated in man(1).

I fear in man(1), that may have to be kept, for historical reason,
though i do think it's a bug that man -aw does not ignore MACHINE.
Then again, unless it's stipulated by POSIX, maybe it should be
removed completely.  Why would anybody tweak the shell to display
manuals for the wrong architecture by *default*?  If i want to see
one specific manual for a different architecture, i will use -S.

> This isn't mentioned in apropos(1) or whatis(1),

No, because such bloat is absent there, as it should.

> but it makes sense to be consistent with man(1)'s environment
> (MANPATH, etc.).  Thoughts?

Please drop that patch, without replacement.

Thanks,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

* Re: Respect MACHINE.
  2011-12-14 11:36 ` Ingo Schwarze
@ 2011-12-14 13:08   ` Kristaps Dzonsons
  0 siblings, 0 replies; 3+ messages in thread
From: Kristaps Dzonsons @ 2011-12-14 13:08 UTC (permalink / raw)
  To: tech

>> The enclosed small patch respects the MACHINE variable
>
> I hate environment variables in general (as opposed to variables
> used inside programs, like those in daily(8) and security(8)).
> I think looking at them is a bad idea in most cases.
> They change behaviour of programs, and as a user,
> it is very easy to forget about variables one has set,
> and it may even happen that the administrator changes
> variables behind one's back (in /etc/profile).
>
> Whenever a program looks at a variable, it should be checked
> whether looking at the variable can be removed, and i'm OK with
> keeping it only when there are very strong reasons to do so.
>
> Adding new variables is almost never OK with me.
>
> Keeping MANPATH is probably OK because it has been around so
> long and many people are probably used to it; removing it would
> be likely to cause more confusion than continuing to support it.
> But adding to that - no, i hate the idea.
>
> Regarding MACHINE, i believe that variable should not be used at
> all except for technical purposes, like in build systems.
> It should not affect which documentation i can find!
> If i had a VAX, i would certainly often use apropos(1) on i386
> or amd64 to search for VAX documentation, just because it's
> faster, and i would not want to fiddle with the environment.
>
>> as stipulated in man(1).
>
> I fear in man(1), that may have to be kept, for historical reason,
> though i do think it's a bug that man -aw does not ignore MACHINE.
> Then again, unless it's stipulated by POSIX, maybe it should be
> removed completely.  Why would anybody tweak the shell to display
> manuals for the wrong architecture by *default*?  If i want to see
> one specific manual for a different architecture, i will use -S.
>
>> This isn't mentioned in apropos(1) or whatis(1),
>
> No, because such bloat is absent there, as it should.
>
>> but it makes sense to be consistent with man(1)'s environment
>> (MANPATH, etc.).  Thoughts?
>
> Please drop that patch, without replacement.

Hi Ingo,

Well!  I've no problems with dropping this, of course.  Just trying to 
keep the manpage tools consistent.  In my opinion, it should really be 
dropped from man(1) as well... it seems totally superfluous, no?

Thanks for the look!

Kristaps
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

end of thread, other threads:[~2011-12-14 13:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-14 10:44 Respect MACHINE Kristaps Dzonsons
2011-12-14 11:36 ` Ingo Schwarze
2011-12-14 13:08   ` Kristaps Dzonsons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).