Skip to content

Commit

Permalink
epkowa: fix parsing of interpreters (#82909) (#89506)
Browse files Browse the repository at this point in the history
Building with -std=c99 breaks the obsolete "%as" format string, which
completely breaks the parsing of epkowa interpreters. This means that
no scanner requiring plugins worked.

(cherry picked from commit e22eb2d)

Co-authored-by: Dominik Honnef <dominik@honnef.co>
  • Loading branch information
symphorien and dominikh committed Jun 7, 2020
1 parent a53ed23 commit 0c2ddc1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkgs/misc/drivers/epkowa/default.nix
Expand Up @@ -244,6 +244,7 @@ stdenv.mkDerivation rec {
sha256 = "04y70qjd220dpyh771fiq50lha16pms98mfigwjczdfmx6kpj1jd";
})
./firmware_location.patch
./sscanf.patch
];
patchFlags = [ "-p0" ];

Expand Down
29 changes: 29 additions & 0 deletions pkgs/misc/drivers/epkowa/sscanf.patch
@@ -0,0 +1,29 @@
The "%as" verb requests sscanf to allocate a buffer for us. However,
this use of 'a' has been long deprecated, and gcc doesn't support it
in this manner when using -std=c99. The modern replacement is "%ms".

Without this change, iscan couldn't read the interpreter file, in turn
breaking all scanners that require plugins.
--- backend/cfg-obj.c.orig 2020-03-19 01:27:17.254762077 +0100
+++ backend/cfg-obj.c 2020-03-19 02:01:52.293329873 +0100
@@ -1026,7 +1026,7 @@
char *vendor = NULL;
char *model = NULL;

- sscanf (string, "%*s %as %as", &vendor, &model);
+ sscanf (string, "%*s %ms %ms", &vendor, &model);

if (list_append (_cfg->seen[CFG_KEY_SCSI], info))
{
@@ -1108,10 +1112,10 @@
char *library = NULL;
char *firmware = NULL;

- sscanf (string, "%*s %*s %x %x %as %as",
+ sscanf (string, "%*s %*s %x %x %ms %ms",
&vendor, &product, &library, &firmware);

if (library && _cfg_have_interpreter (library, firmware)
&& list_append (_cfg->seen[CFG_KEY_INTERPRETER], info))
{

0 comments on commit 0c2ddc1

Please sign in to comment.