FS#71821 - [gnucobol] Arch Linux package GnuCobol does not support JSON GENERATE, original software does

Attached to Project: Arch Linux
Opened by Elmar Klausmeier (eklausmeier) - Thursday, 12 August 2021, 19:34 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:16 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jerome Leclanche (Adys)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description: GnuCobol 3.1.2 officially supports JSON GENERATE, but the Arch Linux version does not.

I removed the Arch Linux package and downloaded the GnuCobol source code and compiled + installed it (configure+make+make install). This original downloaded version does not contain the error.


Additional info:
* package version(s): 3.1.2-1
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:

Run below COBOL program:
```COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. json.
AUTHOR. Elmar Klausmeier.
DATE-WRITTEN. 12-Aug-2021.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 I USAGE BINARY-LONG.
01 IMAX USAGE BINARY-LONG VALUE 20.
01 ARGV PIC X(100) VALUE SPACES.

77 j usage binary-long value 3.
77 jsono pic x(256) value spaces.

01 a1.
02 b.
* 03 c occurs 0 to 2 depending j.
03 c.
04 d pic x value 'd'.
02 e pic x value 'e'.

01 rec.
03 a PIC X(3) VALUE 'A'.
03 b PIC X(3) VALUE ALL 'B'.
03 c.
05 d PIC X(3) VALUE SPACES.



PROCEDURE DIVISION.
DISPLAY "Converting from COBOL to JSON".
ACCEPT ARGV FROM ARGUMENT-VALUE.
MOVE ARGV TO j.

DISPLAY "j = " j.

DISPLAY "a1 = " a1.
JSON GENERATE jsono FROM a1 ON EXCEPTION
display 'cannot generate json from a1'.
DISPLAY "jsono = " function trim(jsono).

DISPLAY "rec = " rec.
JSON GENERATE jsono FROM rec ON EXCEPTION
display 'cannot generate json from rec'.
DISPLAY "jsono = " function trim(jsono).

STOP RUN.


```

Output:
```
./json 3
Converting from COBOL to JSON
j = +0000000003
a1 = de
jsono =
rec = A BBB
jsono =
```

Expected output:
```
./json 4
Converting from COBOL to JSON
j = +0000000004
a1 = de
jsono = {"a1":{"b":{"c":{"d":"d"}},"e":"e"}}
rec = A BBB
jsono = {"rec":{"a":"A","b":"BBB","c":{"d":" "}}}

```

To me it looks that during configuration of GnuCobol, i.e., ./configure step, the config for
```
configure: Used for XML I/O: libxml2
configure: Used for JSON I/O: json-c
```
was missing.


This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:16 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/gnucobol/issues/1
Comment by test0 (test0) - Monday, 22 August 2022, 07:32 GMT
Note: the same applies to XML support.
For both to be available a runtime dependency to libxml and libjsonc should be added, along with a compile-time dependency to their -dev packages.

It _looks_ like ncursesw is also linked in this package so it would be useful to add the explicit dependencies, too - and maybe make them explicit on the configure line, too, something along

configure --with-db --with-curses=ncursesw --with-xml2 --with-json=json-c

Comment by Jerome Leclanche (Adys) - Monday, 22 August 2022, 13:57 GMT
Thanks @test0, pushing an updated build now.
Comment by Jerome Leclanche (Adys) - Monday, 22 August 2022, 14:33 GMT
It looks like half the test suite is now failing (even using the same compile args as before), I suspect due to updated dependencies it might not work well with? Right now I can't recompile, and I don't feel comfortable making a release with the tests failing when the previous release was passing.
Comment by patrick (potomac) - Friday, 18 November 2022, 17:34 GMT
@Jerome : can you tell me on which elements the tests failed? (error messages for example)

Could it be an upstream bug ?
If yes then we should report this problem to gnucobol developers.

Comment by Toolybird (Toolybird) - Tuesday, 15 August 2023, 20:51 GMT
Dupe  FS#79379 

Loading...