Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Jun 2020 13:57:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 244530] print/cups-pdf backend segmentation fault upon upgrade to revision r527186
Message-ID:  <bug-244530-7788-LAbedOcGad@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-244530-7788@https.bugs.freebsd.org/bugzilla/>
References:  <bug-244530-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D244530

taras.filatov@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |taras.filatov@gmail.com

--- Comment #5 from taras.filatov@gmail.com ---
about cups-pdf version 3.0.0
cups-pdf crashes at code
 group=3Dgetgrnam(Conf_Grp);
    grpstat=3Dsetgid(group->gr_gid);
while setting new gid for own process. Conf_Grp is NULL.

this is because conf file assumed /etc/cups/cups-pdf.conf and cannot be ope=
ned.
And at this stage nothing can be logged (previous function
read_config_file(filename); tries to do log_even, but log file still not
open...)

And this is because of mistake in Makefile: in pdf-conf.h now contains
/* location of the configuration file */
#define CP_CONFIG_PATH "/usr/local/etc/cups"

but current Makefile tries to correct this:
post-configure:
        @${REINPLACE_CMD} ${_SUBST_CMD} ${WRKSRC}/extra/cups-pdf.conf
        @${REINPLACE_CMD} -e \
                's,CPCONFIG "/etc/cups/cups-pdf.conf",CPCONFIG
"${ETCDIR}/cups-pdf.conf",' \
                ${WRKSRC}/src/cups-pdf.h

So solution:
1) Makefile should be corrected like this:
--- Makefile.orig       2020-06-07 15:42:18.182963000 +0300
+++ Makefile    2020-06-07 16:50:19.899876000 +0300
@@ -78,7 +78,7 @@
 post-configure:
        @${REINPLACE_CMD} ${_SUBST_CMD} ${WRKSRC}/extra/cups-pdf.conf
        @${REINPLACE_CMD} -e \
-               's,CPCONFIG "/etc/cups/cups-pdf.conf",CPCONFIG
"${ETCDIR}/cups-pdf.conf",' \
+               's,\#define CP_CONFIG_PATH "/etc/cups",\#define CP_CONFIG_P=
ATH
"${ETCDIR}",' \
                ${WRKSRC}/src/cups-pdf.h

 do-build:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

2) if your ever edit cups-pdf.conf and set Grp to nonexistent group, e.g. l=
p,
cups-pdf will crash silently. So I propose add some code to tell about it to
stderr:
--- src/cups-pdf.c.orig 2017-02-24 18:32:46.767977798 +0200
+++ src/cups-pdf.c      2020-06-07 16:18:14.701263000 +0300
@@ -374,7 +374,13 @@
   (void) umask(0077);

   group=3Dgetgrnam(Conf_Grp);
+  if (group !=3D NULL)
     grpstat=3Dsetgid(group->gr_gid);
+  else {
+         fprintf(stderr,"Get group data (getgrnam) failed! group name was
%s\n",Conf_Grp);
+         fprintf(stderr,"GID of process not changed!\n");
+         return 1;
+  }

   if (strlen(Conf_Log)) {
     if (stat(Conf_Log, &fstatus) || !S_ISDIR(fstatus.st_mode)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
put this in file like patch-group_cups-pdf.c and put it inf folder files/
(create int port's folder).

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-244530-7788-LAbedOcGad>