IBM / ibmi-bob

A build system for creating IBM i-native objects using GNU Make.
https://ibm.github.io/ibmi-bob
Apache License 2.0
48 stars 21 forks source link

BOB does not support source or object files beginning with $ #347

Open cosentino-smeup opened 3 months ago

cosentino-smeup commented 3 months ago

I have used SourceOrbit to generate the "Rules.mk" files.:

so -bf bob

It looks like the are problems with objects names that start with "$"

$LOWKXT0F.FILE: $LOWKXT0F.PF
$LOWKXT0L.FILE: $LOWKXT0L.LF $LOWKXT0F.FILE

rules

Is there a way to make SourceOrbit to accept these characters?

cosentino-smeup commented 3 months ago

When I build the project, I receive lots of errors about the rules.

For Example:

make: *** No rule to make target '/Smedoc/bob/P_FENS/SMEQSM/STG640V.DSPF', needed by 'STG640V.FILE'.

The actual name is not "STG640V.DSPF" but "$TSTG640V.DSPF" and the rule has been defined with the actual name.

error

worksofliam commented 1 month ago

I think this is a BOB issue and not a SO issue. I will transfer the issue.

edmundreinhardt commented 3 weeks ago

I noticed @cosentino-smeup reporting this in the comment chain in closed defect https://github.com/IBM/sourceorbit/issues/95 as well.

/tmp/vscodetemp-O_VRHf9Ulw/SRCDZ: /QOpenSys/pkgs/bin/makei cvtsrcpf -c 00280 -t -l SRCDZ P_FENS
{
    "code": 1,
    "signal": null,
    "stdout": "4 source members found.\nConverting $DIZ_ED to $diz_ed.pf\n>  CPYTOSTMF FROMMBR('/QSYS.LIB/P_FENS.LIB/SRCDZ.FILE/$DIZ_ED.MBR') TOSTMF('/tmp/vscodetemp-O_VRHf9Ulw/SRCDZ/$diz_ed.pf') ENDLINFMT(*LF) STMFCCSID(1208) STMFOPT(*REPLACE)\nSuccessfully imported member text!\nConverting $DIZ_JA to $diz_ja.pf\n>  CPYTOSTMF FROMMBR('/QSYS.LIB/P_FENS.LIB/SRCDZ.FILE/$DIZ_JA.MBR') TOSTMF('/tmp/vscodetemp-O_VRHf9Ulw/SRCDZ/$diz_ja.pf') ENDLINFMT(*LF) STMFCCSID(1208) STMFOPT(*REPLACE)\nSuccessfully imported member text!\nConverting $DIZ_C£ to $diz_c£.pf\n>  CPYTOSTMF FROMMBR('/QSYS.LIB/P_FENS.LIB/SRCDZ.FILE/$DIZ_C£.MBR') TOSTMF('/tmp/vscodetemp-O_VRHf9Ulw/SRCDZ/$diz_c£.pf') ENDLINFMT(*LF) STMFCCSID(1208) STMFOPT(*REPLACE)",
    "stderr": "Traceback (most recent call last):\n  File \"/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py\", line 293, in <module>\n    cli()\n  File \"/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py\", line 41, in cli\n    args.handle(args)\n  File \"/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py\", line 269, in handle_cvtsrcpf\n    CvtSrcPf(args.file, args.library, args.tolower, args.ccsid, args.text).run()\n  File \"/QOpenSys/pkgs/lib/bob/src/makei/cvtsrcpf.py\", line 116, in run\n    member_text = result[0][0][0]\nTypeError: 'NoneType' object is not subscriptable"
}
edmundreinhardt commented 3 weeks ago

I acknowledge that gmake which bob is built on top of does not handle source files beginning with $. It will interpret them as variables (which have no value). At this point, it is a limitation. We could come up with an encoding that would map to $. But the problem is that the customer will expect a DB table named $DIZ_ED and so that value needs to be the target in the Makefile (in order to test for its existence and date stamp)

It appears that Makefile has considered this and allows $ to be escaped with $$ https://www.baeldung.com/linux/make-makefile-escape-characters

Note that # needs to be escaped as well. So that

#DBFILE.FILE: #dbfile.pf

is not interpreted as a comment. I propose

^%DBFILE.FILE: ^#dbfile.pf

We need to test that escaping will work in the context of Makefile, then BOB and then generate the escaping characters.

edmundreinhardt commented 3 weeks ago

I noticed @cosentino-smeup reporting this in the comment chain in closed defect IBM/sourceorbit#95 as well.

/tmp/vscodetemp-O_VRHf9Ulw/SRCDZ: /QOpenSys/pkgs/bin/makei cvtsrcpf -c 00280 -t -l SRCDZ P_FENS
{
    "code": 1,
    "signal": null,
    "stdout": "4 source members found.\nConverting $DIZ_ED to $diz_ed.pf\n>  CPYTOSTMF FROMMBR('/QSYS.LIB/P_FENS.LIB/SRCDZ.FILE/$DIZ_ED.MBR') TOSTMF('/tmp/vscodetemp-O_VRHf9Ulw/SRCDZ/$diz_ed.pf') ENDLINFMT(*LF) STMFCCSID(1208) STMFOPT(*REPLACE)\nSuccessfully imported member text!\nConverting $DIZ_JA to $diz_ja.pf\n>  CPYTOSTMF FROMMBR('/QSYS.LIB/P_FENS.LIB/SRCDZ.FILE/$DIZ_JA.MBR') TOSTMF('/tmp/vscodetemp-O_VRHf9Ulw/SRCDZ/$diz_ja.pf') ENDLINFMT(*LF) STMFCCSID(1208) STMFOPT(*REPLACE)\nSuccessfully imported member text!\nConverting $DIZ_C£ to $diz_c£.pf\n>  CPYTOSTMF FROMMBR('/QSYS.LIB/P_FENS.LIB/SRCDZ.FILE/$DIZ_C£.MBR') TOSTMF('/tmp/vscodetemp-O_VRHf9Ulw/SRCDZ/$diz_c£.pf') ENDLINFMT(*LF) STMFCCSID(1208) STMFOPT(*REPLACE)",
    "stderr": "Traceback (most recent call last):\n  File \"/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py\", line 293, in <module>\n    cli()\n  File \"/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py\", line 41, in cli\n    args.handle(args)\n  File \"/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py\", line 269, in handle_cvtsrcpf\n    CvtSrcPf(args.file, args.library, args.tolower, args.ccsid, args.text).run()\n  File \"/QOpenSys/pkgs/lib/bob/src/makei/cvtsrcpf.py\", line 116, in run\n    member_text = result[0][0][0]\nTypeError: 'NoneType' object is not subscriptable"
}

Not that this is not an escaping problem in the Makefile. This is an issue in the cvtsrcpf.py attempt to migrate the file. @irfanshar

edmundreinhardt commented 3 weeks ago

Related to https://github.com/IBM/ibmi-bob/issues/302