Hi all,

I've updated debian/rules and fixes this bug.

I'll wait for 10 days if no other comments.

And then start the NMU process.
The NMU will be uploaded to DELAY/10.

Attachment is the debdiff.

The following changes are made:
  * Change debhelper compat version from 5 to 11. (Closes: #999240)
   - Update debian/rules.
     + This also fixes FTCBFS (Closes: #884727)
   - Clean files by debian/clean
 * Add debian/patches/hardening: hardening format strings.
 * Merge patches from Ubuntu. (Closes: #815936)
 * Add autopkgtest


Yours,
Paul

diff -Nru sc-7.16/debian/changelog sc-7.16/debian/changelog
--- sc-7.16/debian/changelog    2014-05-19 04:13:43.000000000 +0800
+++ sc-7.16/debian/changelog    2022-01-26 01:22:23.000000000 +0800
@@ -1,3 +1,20 @@
+sc (7.16-4.1) unstable; urgency=low
+
+  [ Ying-Chun Liu (PaulLiu) <paul...@debian.org> ]
+  * Non-maintainer upload.
+  * Change debhelper compat version from 5 to 11. (Closes: #999240)
+    - Update debian/rules.
+      + This also fixes FTCBFS (Closes: #884727)
+    - Clean files by debian/clean
+  * Add debian/patches/hardening: hardening format strings.
+  * Merge patches from Ubuntu. (Closes: #815936)
+  * Add autopkgtest
+
+  [ Serge Hallyn <serge.hal...@ubuntu.com> ]
+  * lex.c: do not set notimeout (LP: #1549665)
+
+ -- Ying-Chun Liu (PaulLiu) <paul...@debian.org>  Wed, 26 Jan 2022 01:22:23 
+0800
+
 sc (7.16-4) unstable; urgency=low
 
   * debian/patches/function_definitions
diff -Nru sc-7.16/debian/clean sc-7.16/debian/clean
--- sc-7.16/debian/clean        1970-01-01 08:00:00.000000000 +0800
+++ sc-7.16/debian/clean        2022-01-25 22:44:34.000000000 +0800
@@ -0,0 +1,3 @@
+sc
+psc
+scqref
diff -Nru sc-7.16/debian/compat sc-7.16/debian/compat
--- sc-7.16/debian/compat       2010-05-04 04:51:06.000000000 +0800
+++ sc-7.16/debian/compat       2022-01-25 22:46:13.000000000 +0800
@@ -1 +1 @@
-7
+11
diff -Nru sc-7.16/debian/control sc-7.16/debian/control
--- sc-7.16/debian/control      2014-05-19 04:06:22.000000000 +0800
+++ sc-7.16/debian/control      2022-01-25 22:46:26.000000000 +0800
@@ -1,7 +1,7 @@
 Source: sc
 Section: math
 Priority: optional
-Build-Depends: libncurses5-dev, bison, debhelper (>>7)
+Build-Depends: libncurses5-dev, bison, debhelper (>= 11)
 Maintainer: Adam Majer <ad...@zombino.com>
 Standards-Version: 3.9.5
 Vcs-Browser: http://git.debian.org/?p=collab-maint/sc.git;a=summary
diff -Nru sc-7.16/debian/patches/hardening sc-7.16/debian/patches/hardening
--- sc-7.16/debian/patches/hardening    1970-01-01 08:00:00.000000000 +0800
+++ sc-7.16/debian/patches/hardening    2022-01-26 00:26:25.000000000 +0800
@@ -0,0 +1,189 @@
+Description: hardening format string
+ We should not pass strings as format string directly.
+Author: Ying-Chun Liu (PaulLiu) <paul...@debian.org>
+Last-Update: 2021-01-26
+Index: sc-7.16/cmds.c
+===================================================================
+--- sc-7.16.orig/cmds.c
++++ sc-7.16/cmds.c
+@@ -324,7 +324,7 @@ deleterow(register int arg)
+       rs = rs > 0 ? rs : 0;
+       (void) sprintf(buf, "Can't delete %d row%s %d row%s left", arg,
+               (arg != 1 ? "s," : ","), rs, (rs != 1 ? "s" : ""));
+-      error(buf);
++      error("%s", buf);
+       return;
+     }
+     if (fr) {
+@@ -486,7 +486,7 @@ yankrow(int arg)
+       rs = rs > 0 ? rs : 0;
+       (void) sprintf(buf, "Can't yank %d row%s %d row%s left", arg,
+               (arg != 1 ? "s," : ","), rs, (rs != 1 ? "s" : ""));
+-      error(buf);
++      error("%s", buf);
+       return;
+     }
+     sync_refs();
+@@ -541,7 +541,7 @@ yankcol(int arg)
+       cs = cs > 0 ? cs : 0;
+       (void) sprintf(buf, "Can't yank %d column%s %d column%s left", arg,
+               (arg != 1 ? "s," : ","), cs, (cs != 1 ? "s" : ""));
+-      error(buf);
++      error("%s", buf);
+       return;
+     }
+     sync_refs();
+@@ -1212,7 +1212,7 @@ closecol(int arg)
+       cs = cs > 0 ? cs : 0;
+       (void) sprintf(buf, "Can't delete %d column%s %d column%s left", arg,
+               (arg != 1 ? "s," : ","), cs, (cs != 1 ? "s" : ""));
+-      error(buf);
++      error("%s", buf);
+       return;
+     }
+     if (any_locked_cells(0, curcol, maxrow, curcol + arg - 1)) {
+Index: sc-7.16/interp.c
+===================================================================
+--- sc-7.16.orig/interp.c
++++ sc-7.16/interp.c
+@@ -1986,7 +1986,7 @@ str_search(char *s, int firstrow, int fi
+       scxfree(s);
+       tmp = scxmalloc((size_t)160);
+       regerror(errcode, &preg, tmp, sizeof(tmp));
+-      error(tmp);
++      error("%s", tmp);
+       scxfree(tmp);
+       return;
+     }
+Index: sc-7.16/sc.c
+===================================================================
+--- sc-7.16.orig/sc.c
++++ sc-7.16/sc.c
+@@ -511,7 +511,7 @@ main (int argc, char  **argv)
+                   break;
+           }
+       }
+-      if (redraw) printf(redraw);
++      if (redraw) printf("%s", redraw);
+       exit (0);
+     }
+ 
+Index: sc-7.16/screen.c
+===================================================================
+--- sc-7.16.orig/screen.c
++++ sc-7.16/screen.c
+@@ -1034,7 +1034,7 @@ update(int anychanged)           /* did any cell
+     if (revmsg[0]) {
+       (void) move(0, 0);
+       (void) clrtoeol();      /* get rid of topline display */
+-      (void) printw(revmsg);
++      (void) printw("%s", revmsg);
+       *revmsg = '\0';         /* don't show it again */
+       if (braille)
+           if (message)
+@@ -1055,7 +1055,7 @@ update(int anychanged)           /* did any cell
+     if (revmsg[0]) {
+       (void) move(0, 0);
+       (void) clrtoeol();      /* get rid of topline display */
+-      (void) printw(revmsg);
++      (void) printw("%s", revmsg);
+       *revmsg = '\0';         /* don't show it again */
+       if (braille)
+           if (message)
+Index: sc-7.16/vi.c
+===================================================================
+--- sc-7.16.orig/vi.c
++++ sc-7.16/vi.c
+@@ -1527,7 +1527,7 @@ search_hist()
+     if ((errcode = regcomp(last_search, line, REG_EXTENDED))) {
+       char *tmp = scxmalloc((size_t)160);
+       regerror(errcode, last_search, tmp, sizeof(tmp));
+-      error(tmp);
++      error("%s", tmp);
+       scxfree(tmp);
+       return;
+     }
+@@ -2031,7 +2031,7 @@ query(char *s, char *data)
+       *line = '\0';
+       linelim = 0;
+     }
+-    if (s != NULL) error(s);
++    if (s != NULL) error("%s", s);
+ 
+     while (linelim >= 0) {
+       update(0);
+Index: sc-7.16/vmtbl.c
+===================================================================
+--- sc-7.16.orig/vmtbl.c
++++ sc-7.16/vmtbl.c
+@@ -56,7 +56,7 @@ checkbounds(int *rowp, int *colp)
+     newptr = (type *)scxrealloc((char *)oldptr, \
+           (unsigned)(nelem * sizeof(type))); \
+     if (newptr == (type *)NULL) { \
+-      error(msg); \
++      error("%s", msg);                 \
+       return (FALSE); \
+     } \
+     oldptr = newptr /* wait incase we can't alloc */
+@@ -118,7 +118,7 @@ growtbl(int rowcol, int toprow, int topc
+     if ((rowcol == GROWCOL) || (rowcol == GROWBOTH)) {
+       if ((rowcol == GROWCOL) && ((maxcols == ABSMAXCOLS) ||
+               (topcol >= ABSMAXCOLS))) {
+-          error(nowider);
++          error("%s", nowider);
+           return (FALSE);
+       }
+ 
+@@ -173,7 +173,7 @@ growtbl(int rowcol, int toprow, int topc
+       for (i = 0; i < maxrows; i++) {
+           if ((tbl[i] = (struct ent **)scxrealloc((char *)tbl[i],
+               (unsigned)(newcols * sizeof(struct ent **)))) == (struct ent 
**)0) {
+-          error(nowider);
++          error("%s", nowider);
+           return(FALSE);
+           }
+       for (nullit = ATBL(tbl, i, maxcols), cnt = 0;
+@@ -191,7 +191,7 @@ growtbl(int rowcol, int toprow, int topc
+     for (; i < newrows; i++) {
+       if ((tbl[i] = (struct ent **)scxmalloc((unsigned)(newcols *
+               sizeof(struct ent **)))) == (struct ent **)0) {
+-          error(nowider);
++          error("%s", nowider);
+           return(FALSE);
+       }
+       for (nullit = tbl[i], cnt = 0; cnt < newcols; cnt++, nullit++)
+Index: sc-7.16/sc.h
+===================================================================
+--- sc-7.16.orig/sc.h
++++ sc-7.16/sc.h
+@@ -41,7 +41,7 @@
+ #define COLFORMATS     10     /* Number of custom column formats */
+ #define DELBUFSIZE     40     /* Number of named buffers + 4 */
+ #ifdef PSC
+-# define error(msg)   fprintf(stderr, msg);
++# define error(format, msg...)        fprintf(stderr, format, ## msg);
+ #else
+ # define error(format, msg...) (void)(isatty(fileno(stdout)) && !move(1,0) && 
!clrtoeol() && printw(format, ## msg))
+ #endif
+Index: sc-7.16/gram.y
+===================================================================
+--- sc-7.16.orig/gram.y
++++ sc-7.16/gram.y
+@@ -979,7 +979,7 @@ command:   S_LET var_or_range '=' e
+       |       S_QUERY                 { doquery(NULL, NULL, macrofd); }
+       |       S_QUERY '|' NUMBER      { doquery(NULL, NULL, $3); }
+       |       S_GETKEY                { dogetkey(); }
+-      |       S_ERROR STRING          { error($2); }
++      |       S_ERROR STRING          { error("%s", $2); }
+       |       S_STATUS                        { dostat(macrofd); }
+       |       S_STATUS '|' NUMBER     { dostat($3); }
+       |       S_RECALC                { EvalAll();
+@@ -1010,7 +1010,7 @@ command: S_LET var_or_range '=' e
+       |       S_PLUGOUT STRING '=' STRING
+                                       { addplugin($2, $4, 'w'); } 
+       |       PLUGIN                  { *line = '|';
+-                                        sprintf(line + 1, $1);
++                                        sprintf(line + 1, "%s", $1);
+                                         readfile(line, 0);
+                                         scxfree($1); }
+       |       /* nothing */
diff -Nru sc-7.16/debian/patches/nonotimeout.patch 
sc-7.16/debian/patches/nonotimeout.patch
--- sc-7.16/debian/patches/nonotimeout.patch    1970-01-01 08:00:00.000000000 
+0800
+++ sc-7.16/debian/patches/nonotimeout.patch    2022-01-26 00:34:21.000000000 
+0800
@@ -0,0 +1,35 @@
+Description; do not set notimeout
+ It causes getch to immediately return -1, triggering the warning
+ "Weird character, decimal -1", and stops multi-character commands
+ like 'ir' from working.  This was not a problem before because
+ curses was wrongly ignoring it (see
+ http://invisible-island.net/ncurses/NEWS.html#t20151128)
+Author: Serge Hallyn <serge.hal...@gmail.com>
+Forwarded: yes
+
+Index: sc-7.16/lex.c
+===================================================================
+--- sc-7.16.orig/lex.c
++++ sc-7.16/lex.c
+@@ -650,21 +650,18 @@ void
+ initkbd()
+ {
+     keypad(stdscr, TRUE);
+-    notimeout(stdscr,TRUE);
+ }
+ 
+ void
+ kbd_again()
+ {
+     keypad(stdscr, TRUE);
+-    notimeout(stdscr,TRUE);
+ }
+ 
+ void
+ resetkbd()
+ {
+     keypad(stdscr, FALSE);
+-    notimeout(stdscr, FALSE);
+ }
+ 
+ int
diff -Nru sc-7.16/debian/patches/series sc-7.16/debian/patches/series
--- sc-7.16/debian/patches/series       2014-05-19 04:00:54.000000000 +0800
+++ sc-7.16/debian/patches/series       2022-01-26 00:34:21.000000000 +0800
@@ -2,3 +2,5 @@
 call_function_not_take_its_address
 Upstream-changes-from-old-versions
 function_definitions
+nonotimeout.patch
+hardening
diff -Nru sc-7.16/debian/rules sc-7.16/debian/rules
--- sc-7.16/debian/rules        2014-05-19 04:11:00.000000000 +0800
+++ sc-7.16/debian/rules        2022-01-26 00:21:22.000000000 +0800
@@ -6,90 +6,15 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CFLAGS += -O0
-else
-       CFLAGS += -O2
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-       INSTALL_PROGRAM += -s
-endif
+%:
+       dh $@
 
-configure: configure-stamp
-configure-stamp:
-       dh_testdir
-       # Add here commands to configure the package.
-       touch configure-stamp
+override_dh_auto_build:
+       dh_auto_build -- all sc.1 psc.1 CC=gcc CFLAGS="-Wall -DSYSV3 
-ffloat-store $(CFLAGS)"
 
+override_dh_auto_install:
+       # dh_auto_install
 
-build: build-stamp
-
-build-stamp: configure-stamp 
-       dh_testdir
-
-       # Add here commands to compile the package.
-       $(MAKE) all sc.1 psc.1 CC=gcc CFLAGS="-O2 -Wall -DSYSV3 -ffloat-store"
-       #/usr/bin/docbook-to-man debian/sc.sgml > sc.1
-
-       touch build-stamp
-
-clean:
-       dh_testdir
-       dh_testroot
-       rm -f build-stamp configure-stamp
-
-       # Add here commands to clean up after the build process.
-       -test -f Makefile && $(MAKE) clean
-       rm -f sc psc scqref
+override_dh_auto_clean:
+       dh_auto_clean
        find . -name '*~' -exec rm {} \;
-       rm -rf stamp-build *~
-
-       dh_clean
-
-install: build
-       dh_testdir
-       dh_testroot
-       dh_prep -k 
-       dh_installdirs
-
-       # Add here commands to install the package into debian/sc.
-       # $(MAKE) install DESTDIR=$(CURDIR)/debian/sc
-
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-       dh_testdir
-       dh_testroot
-       dh_installchangelogs CHANGES
-       dh_installdocs
-#      dh_installexamples
-       dh_install
-#      dh_installmenu
-#      dh_installdebconf       
-#      dh_installlogrotate
-#      dh_installemacsen
-#      dh_installpam
-#      dh_installmime
-#      dh_installinit
-#      dh_installcron
-#      dh_installinfo
-       dh_installman
-#      dh_link
-       dh_strip
-       dh_compress -X tutorial.sc
-       dh_fixperms
-#      dh_perl
-#      dh_python
-#      dh_makeshlibs
-       dh_installdeb
-       dh_shlibdeps
-       dh_gencontrol
-       dh_md5sums
-       dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
diff -Nru sc-7.16/debian/tests/control sc-7.16/debian/tests/control
--- sc-7.16/debian/tests/control        1970-01-01 08:00:00.000000000 +0800
+++ sc-7.16/debian/tests/control        2022-01-26 01:09:34.000000000 +0800
@@ -0,0 +1,2 @@
+Tests: test-psc
+Depends: @
diff -Nru sc-7.16/debian/tests/test-psc sc-7.16/debian/tests/test-psc
--- sc-7.16/debian/tests/test-psc       1970-01-01 08:00:00.000000000 +0800
+++ sc-7.16/debian/tests/test-psc       2022-01-26 01:16:39.000000000 +0800
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+
+TEMP=${AUTOPKGTEST_TMP:-${TMPDIR:-$(mktemp -d)}}
+TDIR=$(mktemp -d $TEMP/testpscXXXXXX)
+
+# Prepare data
+cat << EOF > "$TDIR"/data1.txt
+1 2 3 4 5
+a b c d e
+EOF
+
+# Run
+psc < "$TDIR"/data1.txt > "$TDIR"/sheet1.sc
+
+# Check
+grep 'let A0 = 1' "$TDIR"/sheet1.sc
+grep 'let B0 = 2' "$TDIR"/sheet1.sc
+grep 'let E0 = 5' "$TDIR"/sheet1.sc
+grep 'rightstring A1 = "a"' "$TDIR"/sheet1.sc
+grep 'rightstring C1 = "c"' "$TDIR"/sheet1.sc
+grep 'rightstring E1 = "e"' "$TDIR"/sheet1.sc
+

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to