Re: lang/gbc write overflow

2024-04-01 Thread Ivan "Rambius" Ivanov
Ok from me.

On Wed, Mar 27, 2024, 7:04 PM George Koehler  wrote:

> Here's a diff to fix GNU bc 1.07.1 in OpenBSD ports.
>
> Wrong code in bc/scan.c was using (yy_size_t *) to write to an
> int.  This was an overflow on LP64_ARCHS, by writing 8 bytes to a
> 4-byte int.  The problem was more obvious when big-endian.
>
> If we would read 51 bytes,
>  - a little-endian amd64 would write (int []){51, 0}, so result = 51
>was correct, but the extra 0 clobbered 4 bytes of other memory.
>  - my big-endian powerpc64 wrote (int []){0, 51}, so result = 0 caused
>an early end of file.  This broke my powerpc64 build when bc tried
>to compile its math library, but the compiled code was empty.
>
> The new patch does "result = ...", so the C compiler writes the
> correct size.  Now my powerpc64 can package and run gbc.
>
> The patch causes flex(1) to remake scan.c from scan.l.  OpenBSD's
> flex changes result from int to yy_size_t, but "result = ..." should
> work with either type.  (When I tried (int *), I built a broken
> bc that wrote 4 bytes to an 8-byte size.)
>
> Also delete BROKEN-sparc64, but I don't have a sparc64.  I suspect
> that (yy_size_t *) was not a multiple of 8 and raised a SIGBUS
> for misalignment on sparc64, but I don't know.
>
> ok?
>
> Index: Makefile
> ===
> RCS file: /cvs/ports/math/gbc/Makefile,v
> diff -u -p -r1.6 Makefile
> --- Makefile27 Sep 2023 09:27:54 -  1.6
> +++ Makefile27 Mar 2024 22:04:45 -
> @@ -1,9 +1,7 @@
> -BROKEN-sparc64 =   Bus error during build
> -
>  COMMENT =  GNU version of the arbitrary precision calculators bc and
> dc
>  DISTNAME = bc-1.07.1
>  PKGNAME =  g${DISTNAME}
> -REVISION = 0
> +REVISION = 1
>  CATEGORIES =   math
>
>  HOMEPAGE = https://www.gnu.org/software/bc/
> Index: patches/patch-bc_scan_l
> ===
> RCS file: patches/patch-bc_scan_l
> diff -N patches/patch-bc_scan_l
> --- /dev/null   1 Jan 1970 00:00:00 -
> +++ patches/patch-bc_scan_l 27 Mar 2024 22:04:45 -
> @@ -0,0 +1,74 @@
> +The cast (yy_size_t *) was wrong, because result was an int in
> +upstream's flex; this caused an overflow on LP64_ARCHS (by writing 8
> +bytes to a 4-byte int), which broke the build on powerpc64.
> +
> +This patch causes the build to run flex(1), overwriting scan.c from
> +upstream.  OpenBSD's flex changes result from int to yy_size_t.
> +
> +Index: bc/scan.l
> +--- bc/scan.l.orig
>  bc/scan.l
> +@@ -59,7 +59,7 @@ int yywrap (void);
> + /* Have input call the following function. */
> + #undef  YY_INPUT
> + #define YY_INPUT(buf,result,max_size) \
> +-  bcel_input((char *)buf, (yy_size_t *), max_size)
> ++  result = bcel_input((char *)buf, max_size)
> +
> + /* Variables to help interface editline with bc. */
> + static const char *bcel_line = (char *)NULL;
> +@@ -70,10 +70,11 @@ static int   bcel_len = 0;
> +stdin, use editline.  Otherwise, just read it.
> + */
> +
> +-static void
> +-bcel_input (char *buf, yy_size_t  *result, int max)
> ++static int
> ++bcel_input (char *buf, int max)
> + {
> +   ssize_t rdsize;
> ++  int result;
> +   if (!edit || yyin != stdin)
> + {
> +   while ( (rdsize = read( fileno(yyin), buf, max )) < 0 )
> +@@ -82,8 +83,7 @@ bcel_input (char *buf, yy_size_t  *result, int max)
> +   yyerror( "read() in flex scanner failed" );
> +   bc_exit (1);
> + }
> +-  *result = (yy_size_t) rdsize;
> +-  return;
> ++  return rdsize;
> + }
> +
> +   /* Do we need a new string? */
> +@@ -92,9 +92,8 @@ bcel_input (char *buf, yy_size_t  *result, int max)
> +   bcel_line = el_gets(edit, _len);
> +   if (bcel_line == NULL) {
> +   /* end of file */
> +-  *result = 0;
> +   bcel_len = 0;
> +-  return;
> ++  return 0;
> +   }
> +   if (bcel_len != 0)
> +   history (hist, , H_ENTER, bcel_line);
> +@@ -104,16 +103,17 @@ bcel_input (char *buf, yy_size_t  *result, int max)
> +   if (bcel_len <= max)
> + {
> +   strncpy (buf, bcel_line, bcel_len);
> +-  *result = bcel_len;
> ++  result = bcel_len;
> +   bcel_len = 0;
> + }
> +   else
> + {
> +   strncpy (buf, bcel_line, max);
> +-  *result = max;
> ++  result = max;
> +   bcel_line += max;
> +   bcel_len -= max;
> + }
> ++  return result;
> + }
> + #endif
> +
>


Re: [UPDATE] editors/le to 1.16.8

2021-03-22 Thread Ivan &quot;Rambius&quot; Ivanov
Hello,

I tested the change on i386. Looks good.

Regards
rambius

On Thu, Mar 11, 2021 at 5:57 AM Frederic Cambus  wrote:
>
> Hi ports@,
>
> Here is a diff to update le to 1.16.8.
>
> Comments? OK?
>
> Index: Makefile
> ===
> RCS file: /cvs/ports/editors/le/Makefile,v
> retrieving revision 1.16
> diff -u -p -r1.16 Makefile
> --- Makefile1 Jan 2020 18:56:32 -   1.16
> +++ Makefile11 Mar 2021 09:54:55 -
> @@ -1,7 +1,7 @@
>  # $OpenBSD: Makefile,v 1.16 2020/01/01 18:56:32 bcallah Exp $
>
>  COMMENT =  text editor inspired by Norton Commander
> -DISTNAME = le-1.16.7
> +DISTNAME = le-1.16.8
>  CATEGORIES =   editors
>
>  HOMEPAGE = http://lav.yar.ru/programs.html
> Index: distinfo
> ===
> RCS file: /cvs/ports/editors/le/distinfo,v
> retrieving revision 1.7
> diff -u -p -r1.7 distinfo
> --- distinfo1 Jan 2020 18:56:32 -   1.7
> +++ distinfo11 Mar 2021 09:54:55 -
> @@ -1,2 +1,2 @@
> -SHA256 (le-1.16.7.tar.gz) = HL4IHrox5pM2PJuKhGSvEH5Lq/0jVKCaF9wxWzYFr0E=
> -SIZE (le-1.16.7.tar.gz) = 1063942
> +SHA256 (le-1.16.8.tar.gz) = WVkPOI1Gibe2PWDrN0VJuFh5YCuU/A4IQ/fGWmZILB4=
> +SIZE (le-1.16.8.tar.gz) = 1103297



-- 
Tangra Mega Rock: http://www.radiotangra.com



Re: NEW: math/bc

2018-06-26 Thread Ivan &quot;Rambius&quot; Ivanov
Hello Brian,

On Mon, Jun 25, 2018 at 5:35 PM, Brian Callahan  wrote:
> Hi Ivan --
> Thanks for the submission! I'm happy to have this in ports. I've made some
> tweaks to put this more in line with what we do with ports of other GNU
> versions of utilities (like gmake, gtar, gdiff, etc.): change the port
> directory and PKGNAME gbc and tweak the COMMENT and DESCR a little.

Thank you for reviewing the port.

>
> I also added --with-libedit to CONFIGURE_ARGS, because the line editing is
> nice to have I think (and /usr/bin/bc has it).
>
> Tarball with these tweaks attached.

I tested the new tarball on i386 and it works for me.

Regards
rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com



NEW: math/bc

2018-06-24 Thread Ivan &quot;Rambius&quot; Ivanov
Hello ports,

Attached is a new port for gnu bc:

pkg/DESCR:
bc is an arbitrary precision numeric processing language. Syntax is similar to
C, but differs in many substantial areas. It supports interactive execution of
statements. bc is a utility included in the POSIX P1003.2/D11 draft standard.

HOMEPAGE: https://www.gnu.org/software/bc/

I added --program-prefix="g" in CONFIGURE_ARGS  to prevent conflicts with
/usr/bin/bc and /usr/bin/gc. I tested the port on i386.

OK?

Regards
rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com


bc.tar.gz
Description: application/gzip


UPDATE: editors/le

2016-10-23 Thread Ivan &quot;Rambius&quot; Ivanov
Hello,

Here is a patch that updates editors/le from 1.16.1 to 1.16.3.

OK?

Regards
Rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com
Index: Makefile
===
RCS file: /cvs/ports/editors/le/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- Makefile9 Apr 2016 20:14:48 -   1.4
+++ Makefile24 Oct 2016 01:47:38 -
@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.4 2016/04/09 20:14:48 naddy Exp $
 
 COMMENT =  text editor inspired by Norton Commander
-DISTNAME = le-1.16.1
+DISTNAME = le-1.16.3
 CATEGORIES =   editors
 
 HOMEPAGE = http://lav.yar.ru/programs.html
Index: distinfo
===
RCS file: /cvs/ports/editors/le/distinfo,v
retrieving revision 1.3
diff -u -p -r1.3 distinfo
--- distinfo22 Mar 2016 18:57:41 -  1.3
+++ distinfo24 Oct 2016 01:47:38 -
@@ -1,2 +1,2 @@
-SHA256 (le-1.16.1.tar.gz) = VLc4IFT2n0r4qQmNGWxkY1CCGfXUzrRsFigWWGHnhrU=
-SIZE (le-1.16.1.tar.gz) = 977143
+SHA256 (le-1.16.3.tar.gz) = PiA0bBjWKGkl6TDp5yNauKUXb05PhL7k0XGZ0/DxpjQ=
+SIZE (le-1.16.3.tar.gz) = 985541
Index: pkg/PLIST
===
RCS file: /cvs/ports/editors/le/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- pkg/PLIST   22 Mar 2016 18:57:41 -  1.2
+++ pkg/PLIST   24 Oct 2016 01:47:38 -
@@ -23,6 +23,7 @@ share/le/syntax.d/c++-comment
 share/le/syntax.d/c-comment
 share/le/syntax.d/c-literal
 share/le/syntax.d/cpp
+share/le/syntax.d/css
 share/le/syntax.d/eiffel
 share/le/syntax.d/fvwm2
 share/le/syntax.d/gema


UPDATE: editors/le

2016-03-21 Thread Ivan &quot;Rambius&quot; Ivanov
Hello,

Here is a patch that updates editors/le from 1.15.1 to 1.16.1.

OK?

Regards
Rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com
Index: Makefile
===
RCS file: /cvs/ports/editors/le/Makefile,v
retrieving revision 1.2
diff -u -p -u -r1.2 Makefile
--- Makefile	23 Dec 2014 18:34:47 -	1.2
+++ Makefile	21 Mar 2016 13:29:02 -
@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.2 2014/12/23 18:34:47 bcallah Exp $
 
 COMMENT =	text editor inspired by Norton Commander
-DISTNAME =	le-1.15.1
+DISTNAME =	le-1.16.1
 CATEGORIES =	editors
 
 HOMEPAGE =	http://lav.yar.ru/programs.html
Index: distinfo
===
RCS file: /cvs/ports/editors/le/distinfo,v
retrieving revision 1.2
diff -u -p -u -r1.2 distinfo
--- distinfo	23 Dec 2014 18:34:47 -	1.2
+++ distinfo	21 Mar 2016 13:29:02 -
@@ -1,2 +1,2 @@
-SHA256 (le-1.15.1.tar.gz) = fjXWMfWIKW/RqWbwZxCrC7+UnWPAIBoE6x4kAcZUs+c=
-SIZE (le-1.15.1.tar.gz) = 847146
+SHA256 (le-1.16.1.tar.gz) = VLc4IFT2n0r4qQmNGWxkY1CCGfXUzrRsFigWWGHnhrU=
+SIZE (le-1.16.1.tar.gz) = 977143
Index: pkg/PLIST
===
RCS file: /cvs/ports/editors/le/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -u -r1.1.1.1 PLIST
--- pkg/PLIST	19 Sep 2014 22:23:29 -	1.1.1.1
+++ pkg/PLIST	21 Mar 2016 13:29:02 -
@@ -9,9 +9,10 @@ share/le/colors-defbg
 share/le/colors-green
 share/le/colors-white
 share/le/help
+share/le/keymap-default
 share/le/keymap-emacs
 share/le/le.hlp
-share/le/mainmenu
+share/le/mainmenu-default
 share/le/mainmenu-ru
 share/le/syntax
 share/le/syntax.d/
@@ -33,12 +34,15 @@ share/le/syntax.d/javascript
 share/le/syntax.d/logrotate-conf
 share/le/syntax.d/lout
 share/le/syntax.d/make-file
+share/le/syntax.d/markdown
 share/le/syntax.d/metafont
 share/le/syntax.d/named-conf
+share/le/syntax.d/nroff
 share/le/syntax.d/ocaml
 share/le/syntax.d/pascal
 share/le/syntax.d/perl
 share/le/syntax.d/php
+share/le/syntax.d/pod
 share/le/syntax.d/python
 share/le/syntax.d/sather
 share/le/syntax.d/shell


NEW: games/quit

2014-09-07 Thread Ivan Rambius Ivanov
Hello,

I created a port for quit - https://github.com/fukuchi/quit.

From its README:

QUIT is a forked and modified version of Masashi Toyoda's famous joke
soft 'SL', aimed to correct you when you type 'sl' instead of 'ls' by
mistake. Quit prevents you from quitting command shell, while actually
you intended to 'exit' from it.

OK?

Regards
Rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com


quit.tar.gz
Description: GNU Zip compressed data


Re: NEW: editors/le

2014-08-23 Thread Ivan Rambius Ivanov
Hello,

On Fri, Aug 22, 2014 at 11:15 AM, Brian Callahan bcal...@devio.us wrote:

 On 08/22/14 10:25, Vadim Zhukov wrote:

 2014-08-22 18:05 GMT+04:00 Brian Callahan bcal...@devio.us:

 On 08/22/14 10:00, Vadim Zhukov wrote:
 1. For MAINTAINER line, please, get rid of quotes. Ivan Ivanov
 em...@domain.com is enough.
 (Trying to not joke about name. Trying hard, ever)

I changed the MAINTAINER line.


 2. Backspace key doesn't work for me correctly: in editing mode, it
 acts like Delete key, and in calculator it does nothing.


 Hmm... backspace key works in both editing mode and calculator mode just
 fine (amd64). I don't have a i386 to test (that's what you're using,
 right
 Vadim?)

 Yes. I've did more tests, it looks like the problem arises under tmux
 only (thus adding nicm@ to a conversation). Not sure what should be
 blamed then. Probably worths a note in DESCR or README, though. But I
 don't insist.


 Not sure either, but I was able to reproduce backspace not working in tmux
 on amd64 as well.


I was able to reproduce the issue about backspace in tmux as well. I
will contact le's developer about it.


Regards
Rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com


le.tar.gz
Description: GNU Zip compressed data


NEW: editors/le

2014-08-21 Thread Ivan Rambius Ivanov
Hello,

le is a text editor inspired by Norton Commander.

It works fine on i386

ok?

Regards
Rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com


le.tar.gz
Description: GNU Zip compressed data