discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Solaris 10 regcomp() does not handle simple whatis query
@ 2015-04-03 12:02 Peter Bray
  2015-04-03 12:52 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Bray @ 2015-04-03 12:02 UTC (permalink / raw)
  To: discuss

Greetings,

I am having trouble viewing the GMAME web archive of the mailing
list, so please excuse me if this post is a repeat of a known issue.

I was investigating mdocml on a Solaris 10 (X86_64) system and
discovered that the latest release does not compile, but the latest
CVS 2015-04-01 does :-) Many thanks to those responsible!

Using the configure.local shown at the end of this message, I was able
to build and use mdocml ;-)

My testing shows that Solaris 10's regcomp() can not handle the
character class used by mdocml's whatis(1): for example: the query
'whatis' generates "[[:<:]]whatis[[:>:]]" which gives the error
"regcomp: invalid character class type", as shown below

   makewhatis  /pkgs/64-bit/release/mdocml-cvs_2014_04_01-basic/share/man
   whatis -M /pkgs/64-bit/release/mdocml-cvs_2014_04_01-basic/share/man 
whatis
regcomp: invalid character class type
usage: whatis [-acfhklw] [-C file] [-M path] [-m path] [-O outkey] [-S arch]
               [-s section] name ...

   apptrace whatis -M 
/pkgs/64-bit/release/mdocml-cvs_2014_04_01-basic/share/man whatis
...<snip>...
-> whatis   -> libc.so.1:int vasprintf(char ** = 0xfffffd7fffdfdcf8, 
const char * = 0x45951e "[[:<:]]%s[[:>:]]", struct __va_list_tag * = 
0xfffffd7fffdfdbf0)
<- whatis   -> libc.so.1:vasprintf() = 0x14
-> whatis   -> libc.so.1:int regcomp(regex_t * = 0x47fd10, const char * 
= 0x47fd90 "[[:<:]]whatis[[:>:]]", int = 0x7)
<- whatis   -> libc.so.1:regcomp() = 0xd
-> whatis   -> libc.so.1:void free(void * = 0x47fd90)
<- whatis   -> libc.so.1:free()
-> whatis   -> libc.so.1:size_t regerror(int = 0xd, const regex_t * = 
0x47fd10, char * = 0xfffffd7fffdfdd00 "...<random_junk>...", size_t = 0x400)
<- whatis   -> libc.so.1:regerror() = 0x1d
-> whatis   -> libc.so.1:int fprintf(FILE * = 0x47b980, const char * = 
0x459537 "regcomp: %s
")
regcomp: invalid character class type
...<snip>...


This is from mansearch.c's exprterm()

    756  static struct expr *
    757  exprterm(const struct mansearch *search, char *buf, int cs)
    758  {
...
    777          /*
    778           * Separate macro keys from search string.
    779           * If needed, request regular expression handling
    780           * by setting e->substr to NULL.
    781           */
    782
    783          if (search->argmode == ARG_WORD) {
    784                  e->bits = TYPE_Nm;
    785                  e->substr = NULL;
    786                  mandoc_asprintf(&val, "[[:<:]]%s[[:>:]]", buf);
    787                  cs = 0;

Depending on the complexity, maybe a BSD version of regcomp() could be
included with mdocml, to get the desired functionality and not have to
reduce the functionality currently available to mdocml users.
Alternatively, the code could make exceptions for broken (by the
project's standards) regcomp() implementations.

Regards,
Peter Bray
Sydney, Australia

# Local Configuration Options
cat configure.local

PREFIX="/pkgs/64-bit/release/mdocml-cvs_2014_04_01-basic"
MANDIR="${PREFIX}/share/man"
INSTALL="ginstall"
DBLIB="-L/pkgs/64-bit/lib -lsqlite3"
CFLAGS="${CFLAGS} -I/pkgs/64-bit/include"
MANPATH_DEFAULT="/pkgs/64-bit/man:/pkgs/64-bit/share/man:/pkgs/man:/pkgs/share/man:/usr/share/man"
# roff.7 conflicts with groff's version, make all section 7 manual 
entries unique
MANM_MAN="mandoc_man"           # default is "man"
MANM_MDOC="mandoc_mdoc"         # default is "mdoc"
MANM_ROFF="mandoc_roff"         # default is "roff"
MANM_EQN="mandoc_eqn"           # default is "eqn"
MANM_TBL="mandoc_tbl"           # default is "tbl"
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

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

* Re: Solaris 10 regcomp() does not handle simple whatis query
  2015-04-03 12:02 Solaris 10 regcomp() does not handle simple whatis query Peter Bray
@ 2015-04-03 12:52 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2015-04-03 12:52 UTC (permalink / raw)
  To: Peter Bray; +Cc: discuss

Hi Peter,

Peter Bray wrote on Fri, Apr 03, 2015 at 11:02:16PM +1100:

> I am having trouble viewing the GMAME web archive of the mailing
> list, so please excuse me if this post is a repeat of a known issue.

Duplicate reports are better than missing ones, so unless you are
completely sure something is known, always speak up.  Even dupes
are sometimes useful because they help to adjust priorities.

> I was investigating mdocml on a Solaris 10 (X86_64) system and
> discovered that the latest release does not compile, but the latest
> CVS 2015-04-01 does :-) Many thanks to those responsible!

You are welcome.  That would be me, various people reporting issues,
and the friendly folks from OpenCSW who provide testing opportunities
on their build cluster.

> My testing shows that Solaris 10's regcomp() can not handle the
> character class used by mdocml's whatis(1): for example: the query
> 'whatis' generates "[[:<:]]whatis[[:>:]]" which gives the error
> "regcomp: invalid character class type", as shown below

I dimly remember hearing that before, and indeed [[:<:]] is not
required by POSIX but a BSD extension.

> Depending on the complexity, maybe a BSD version of regcomp() could be
> included with mdocml, to get the desired functionality and not have to
> reduce the functionality currently available to mdocml users.

Bundling a full regular expression library seems a bit much,
that code isn't exactly small.

> Alternatively, the code could make exceptions for broken (by the
> project's standards) regcomp() implementations.

Sounds better, i added an entry to the TODO list, see below.

Yours,
  Ingo


Log Message:
-----------
portability: word boundaries in regular expressions

Modified Files:
--------------
    mdocml:
        TODO

Revision Data
-------------
Index: TODO
===================================================================
RCS file: /home/cvs/mdocml/mdocml/TODO,v
retrieving revision 1.203
retrieving revision 1.204
diff -LTODO -LTODO -u -p -r1.203 -r1.204
--- TODO
+++ TODO
@@ -488,6 +488,14 @@ are mere guesses, and some may be wrong.
   loc **  exist **  algo **  size *  imp **
 
 ************************************************************************
+* portability
+************************************************************************
+
+- word boundaries in regular expressions for whatis(1)
+  set up config tests to use [[:<:]], \<, or nothing
+  reminded by Peter Bray Fri, 03 Apr 2015 23:02:16 +1100
+
+************************************************************************
 * warning issues
 ************************************************************************
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

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

end of thread, other threads:[~2015-04-03 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-03 12:02 Solaris 10 regcomp() does not handle simple whatis query Peter Bray
2015-04-03 12:52 ` Ingo Schwarze

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