Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 757687 - sci-electronics/ngspice-27-r1 build fails with error: ‘sys_errlist’ undeclared
Summary: sci-electronics/ngspice-27-r1 build fails with error: ‘sys_errlist’ undeclared
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Soldering-Iron Brotherhood
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: glibc-2.32
  Show dependency tree
 
Reported: 2020-11-29 23:01 UTC by Alex Orange
Modified: 2021-08-05 03:18 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,901.96 KB, text/x-log)
2020-11-29 23:01 UTC, Alex Orange
Details
emerge --info (emerge-info,5.66 KB, text/plain)
2020-11-29 23:01 UTC, Alex Orange
Details
emerge -pqv (emerge-pqv,224 bytes, text/plain)
2020-11-29 23:02 UTC, Alex Orange
Details
environment (environment,66.56 KB, text/plain)
2020-11-29 23:02 UTC, Alex Orange
Details
Patch candidate (ngspice-27-fix_str_errlist.patch,679 bytes, patch)
2020-11-29 23:39 UTC, Alex Orange
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Orange 2020-11-29 23:01:39 UTC
Created attachment 675775 [details]
build.log

sci-electronics/ngspice-27-r1 fails to build with the following errors:

In file included from plot5.c:5:
plot5.c: In function ‘Plt5_NewViewport’:
../../../src/include/ngspice/ngspice.h:311:60: error: ‘sys_errlist’ undeclared (first use in this function)
  311 | #define perror(string) fprintf(stderr, "%s: %s\n", string, sys_errlist[errno])
      |                                                            ^~~~~~~~~~~
gnuplot.c:129:9: note: in expansion of macro ‘perror’
  129 |         perror(filename);
      |         ^~~~~~
../../../src/include/ngspice/ngspice.h:311:60: note: each undeclared identifier is reported only once for each function it appears in
  311 | #define perror(string) fprintf(stderr, "%s: %s\n", string, sys_errlist[errno])
      |                                                            ^~~~~~~~~~~
gnuplot.c:129:9: note: in expansion of macro ‘perror’
  129 |         perror(filename);
      |         ^~~~~~
../../../src/include/ngspice/ngspice.h:311:60: error: ‘sys_errlist’ undeclared (first use in this function)
  311 | #define perror(string) fprintf(stderr, "%s: %s\n", string, sys_errlist[errno])
      |                                                            ^~~~~~~~~~~
plot5.c:50:9: note: in expansion of macro ‘perror’
   50 |         perror((char*) graph->devdep);
      |         ^~~~~~
../../../src/include/ngspice/ngspice.h:311:60: note: each undeclared identifier is reported only once for each function it appears in
  311 | #define perror(string) fprintf(stderr, "%s: %s\n", string, sys_errlist[errno])
      |                                                            ^~~~~~~~~~~
plot5.c:50:9: note: in expansion of macro ‘perror’
   50 |         perror((char*) graph->devdep);
      |         ^~~~~~
gnuplot.c: In function ‘ft_writesimple’:
../../../src/include/ngspice/ngspice.h:311:60: error: ‘sys_errlist’ undeclared (first use in this function)
  311 | #define perror(string) fprintf(stderr, "%s: %s\n", string, sys_errlist[errno])
      |                                                            ^~~~~~~~~~~
gnuplot.c:360:9: note: in expansion of macro ‘perror’
  360 |         perror(filename);
      |         ^~~~~~
Comment 1 Alex Orange 2020-11-29 23:01:58 UTC
Created attachment 675778 [details]
emerge --info
Comment 2 Alex Orange 2020-11-29 23:02:11 UTC
Created attachment 675781 [details]
emerge -pqv
Comment 3 Alex Orange 2020-11-29 23:02:24 UTC
Created attachment 675784 [details]
environment
Comment 4 Alex Orange 2020-11-29 23:39:45 UTC
Created attachment 675790 [details, diff]
Patch candidate

This patch seems to solve the problem (it builds). However I need to emphasize that I have no idea what sys_errlist was supposed to be, some old relic of libc or w/e. Someone who actually knows what's going on please review.

***REVIEW REQUESTED***
Comment 5 Karl Hammar 2020-12-20 03:05:09 UTC
According to:
 https://sourceware.org/pipermail/libc-announce/2020/000029.html

 "The GNU C Library version 2.32 is now available
...
* The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr
  are no longer available to newly linked binaries, and their declarations
  have been removed from from <stdio.h>.  They are exported solely as
  compatibility symbols to support old binaries.  All programs should use
  strerror or strerror_r instead.
"

///

In comment 4, Alex wounders what sys_errlist is.
If you do
 $ man 2 stat
there is a header named "ERRORS" with items like "EACCES".
Thoose constants (integers) are defined in files like
 /usr/include/asm-generic/errno-base.h
 /usr/include/asm-generic/errno.h
describing what went wrong with a system call, e.g.
 $ grep EACCES asm-generic/errno*h
 asm-generic/errno-base.h:#define        EACCES          13      /* Permission denied */

The sys_errlist[] was a way to convert that number (13) to the string
"Permission denied" so the programmer can print out some hopeful text
to explain what went wrong, e.g.
 $ rm -f /etc/passwd
 rm: cannot remove '/etc/passwd': Permission denied
Comment 6 Alex Orange 2020-12-20 16:39:16 UTC
Thank you Karl, you found the documentation to support what I did. Looks like I took the right action by instinct, I say review complete from my side and suggest that this patch be put into production.
Comment 7 Michael Grey 2021-01-24 23:19:10 UTC
(In reply to Alex Orange from comment #6)
> Thank you Karl, you found the documentation to support what I did. Looks
> like I took the right action by instinct, I say review complete from my side
> and suggest that this patch be put into production.

I can confirm that this patch works. This should be fixed upstream in my opinion.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-01-24 23:37:46 UTC
Has anyone sent this upstream-upstream?
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-08-05 03:18:40 UTC
This actually seems to be fixed in ngspice-34 at least!