Accepting request 139660 from Base:System

- Make shadowed manual pages accessible (bnc#786679)

OBS-URL: https://build.opensuse.org/request/show/139660
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/man?expand=0&rev=52
This commit is contained in:
Stephan Kulow 2012-11-02 06:30:56 +00:00 committed by Git OBS Bridge
commit 680a7ae445
2 changed files with 29 additions and 10 deletions

View File

@ -1,6 +1,6 @@
--- src/man.c --- src/man.c
+++ src/man.c 2008-11-28 12:12:22.000000000 +0000 +++ src/man.c 2012-10-29 13:48:02.134344676 +0100
@@ -3712,12 +3712,132 @@ static int locate_page (const char *manp @@ -3712,12 +3712,141 @@ static int locate_page (const char *manp
return found; return found;
} }
@ -26,8 +26,9 @@
+#if defined(PROMPT_IF_MULTIPLE_SECTIONS) && (PROMPT_IF_MULTIPLE_SECTIONS > 1) +#if defined(PROMPT_IF_MULTIPLE_SECTIONS) && (PROMPT_IF_MULTIPLE_SECTIONS > 1)
+ char reqsect[64] = { 0 }; + char reqsect[64] = { 0 };
+ ssize_t len = 0; + ssize_t len = 0;
+ int index = -1;
+ const char *lext;
+ do { + do {
+ const char *lext;
+ struct sigaction sa; + struct sigaction sa;
+ int used = 0x2A; + int used = 0x2A;
+ +
@ -56,12 +57,12 @@
+ lext = NULL; + lext = NULL;
+ for (candp = candidates; candp; candp = candp->next) { + for (candp = candidates; candp; candp = candp->next) {
+ const struct mandata *info = candp->source; + const struct mandata *info = candp->source;
+ const char *base = "";
+ +
+ if (lext && STREQ(lext, info->ext)) + if (lext && STREQ(lext, info->ext))
+ base = "+"; + fprintf(stderr, " %c %s (%s+%d)", used, info->name, info->ext, candp->add_index);
+ else
+ fprintf(stderr, " %c %s (%s)", used, info->name, info->ext);
+ +
+ fprintf(stderr, " %c %s (%s%s)", used, info->name, info->ext, base);
+ if (info->whatis) + if (info->whatis)
+ fprintf(stderr, "\t%s", info->whatis); + fprintf(stderr, "\t%s", info->whatis);
+ fputc('\n', stderr); + fputc('\n', stderr);
@ -97,6 +98,8 @@
+ if ((end = strchr(reqsect, '+'))) { + if ((end = strchr(reqsect, '+'))) {
+ plain = 1; + plain = 1;
+ *end = '\0'; + *end = '\0';
+ if (*++end)
+ index = atoi(end);
+ } + }
+ reqsect[len] = '\0'; + reqsect[len] = '\0';
+ len = (ssize_t)strlen(reqsect); + len = (ssize_t)strlen(reqsect);
@ -109,6 +112,8 @@
+ if (base && !STREQ(base, "/man")) + if (base && !STREQ(base, "/man"))
+ continue; + continue;
+ } + }
+ if (index >= 0 && index != candp->add_index)
+ continue;
+ if ((found = STREQ(reqsect, candp->source->ext))) + if ((found = STREQ(reqsect, candp->source->ext)))
+ break; + break;
+ } + }
@ -127,13 +132,17 @@
+ if (base && !STREQ(base, "/man")) + if (base && !STREQ(base, "/man"))
+ continue; + continue;
+ } + }
+ if (len && !STREQ(reqsect, candp->source->ext)) + if (len) {
+ continue; + if (!STREQ(reqsect, candp->source->ext))
+ continue;
+ if (index >= 0 && index != candp->add_index)
+ continue;
+ }
+#endif +#endif
global_manpath = is_global_mandir (candp->path); global_manpath = is_global_mandir (candp->path);
if (!global_manpath) if (!global_manpath)
drop_effective_privs (); drop_effective_privs ();
@@ -3739,9 +3859,51 @@ static int display_pages (struct candida @@ -3739,9 +3868,56 @@ static int display_pages (struct candida
regain_effective_privs (); regain_effective_privs ();
if (found && !findall) if (found && !findall)
@ -167,13 +176,18 @@
+ fputs(_("find all matching manual pages"), stderr); + fputs(_("find all matching manual pages"), stderr);
+ fputc('\n', stderr); + fputc('\n', stderr);
+ +
+ lext = NULL;
+ do { + do {
+ struct mandata *info = candp->source; + struct mandata *info = candp->source;
+ fprintf(stderr, " %c %s (%s)", used, info->name, info->ext); + if (lext && STREQ(lext, info->ext))
+ fprintf(stderr, " %c %s (%s+%d)", used, info->name, info->ext, candp->add_index);
+ else
+ fprintf(stderr, " %c %s (%s)", used, info->name, info->ext);
+ if (info->whatis) { + if (info->whatis) {
+ fprintf(stderr, "\t%s", info->whatis); + fprintf(stderr, "\t%s", info->whatis);
+ } + }
+ fputc('\n', stderr); + fputc('\n', stderr);
+ lext = info->ext;
+ used = ' '; + used = ' ';
+ } while ((candp = candp->next)); + } while ((candp = candp->next));
+ fflush(stderr); + fflush(stderr);

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Oct 29 12:55:03 UTC 2012 - werner@suse.de
- Make shadowed manual pages accessible (bnc#786679)
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Oct 9 15:20:03 UTC 2012 - werner@suse.de Tue Oct 9 15:20:03 UTC 2012 - werner@suse.de