Local development, IFS file CCSID and bash startup files #1459
Replies: 1 comment 1 reply
-
Welcome to CCSID hell! Here are my thoughts and opinions:
The easiest way is putting your The good news is that in IBM i 7.4, 1208 would be the default PASE CCSID and some of these woes get mitigated.
Yes. I have a strong opinion that everything should be UTF-8 unless there is a hard requirement for something else.
|
Beta Was this translation helpful? Give feedback.
-
I'm in the process of trying out local development and working out how this can work for me when I stumbled across something that took me by surprise and is still causing me a lot of head scratching and shouts of "really!".
A bit of background:
I'm using an IBM i 7.5 server.
I'm looking at some of the open source RPG projects that have been made public to see how I can make use of them and also how others have approached the challenge of building their projects on IBM i. The one I'm currently looking at is llist project, which includes a
Makefile
and is well structured and thought out.I use the Bash shell exclusively on IBM i. I can't think of a reason not to so I think it's reasonable, for any projects that I develop, that it's safe for me to assume that Bash will be available. My
.profile
file adds the/QOpenSys/pkgs/bin
to my path and I've also installed themake-gnu
and thetar-gnu
packages.What took me by surprise was that I was getting different results when I attempt to "make" the project from a Bash terminal and when I "make" the project from within VS Code.
The action I have defined in VS Code to "make" the project is as follows.
When I run the
/QOpenSys/usr/bin/make all
command from a Bash shell terminal session it fails. I understand why it fails, I need to update theMakefile
compile command to include theTGTCCSID(*JOB)
parameter. The files were created in the IFS using git clone and when I look at the CCSID value of the files they have a value of 1208 (UTF-8). This seemed OK to me.The thing that took me by surprise was that when I "make" the project in VS Code it worked! I was expecting the same failure.
This is when the head scratching started.
When I looked at the CCSID value on one of the files, deployed to my VS Code build directory, I realised the IFS files had a CCSID value of 819 (ISO 8859-1 ASCII), not 1208 (UTF-8) as I'd expected.
I looked in the VS Code output tabs and found the following command in the Code for IBM i output.
/QOpenSys/pkgs/bin/tar -xof /tmp/deploy_O_kjwXDf45.tar && rm -rf PaxHeader
The deployment stage of local development creates a local tarball that is then transferred to my IBM i server and extracted to the remote deployment directory and the command did the business of extracting the files. This is using the version of
tar
installed using thetar-gnu
package. Good, this is what I expected.What I eventually worked out, with the help of Google and a lot more head scratching, was that the commands executed by VS Code are processed via
ssh
, that wasn't a surprise. The bit that did surprise me to learn was that the when commands are executed viassh
they are executed as a non-interactive non-login shell, yeah right, which basically means that the user specific startup files (except.bashrc
) are not executed. This means that none of the stuff in my.profile
file was being executed.One of the environment variables I set in my
.profile
file isLC_ALL
.LC_ALL=EN_GB.UTF-8 export LC_ALL
The result of this is that files created in the IFS by me are created with a CCSID of 1208. I can't remember exactly when I added this or the specific reasons but it does seem to make sense especially as the open source projects are created in different locales.
If I remove the
LC_ALL
environment variable from my.profile
and clone the repo again the files are created with a CCSID of 819 and the make command works as it did via VS Code.I'm not sure why CCSID 819 is used. I couldn't find any definitive reference that stated this was a default value but if I change the
LC_ALL
it does impact on the the CCSID of files I create.Some useful reference material:
Anyway, the reason I created this discussion was to get some opinions on the following.
Have I got this right or is there an easy way of dealing with this?
Should open source project files be created in the IFS with a CCSID of 1208?
ssh
heavily so this could be an issue as it's not at all clear (at least it wasn't to me) that the environment that the commands are processed in is not the same as the users interactive Bash session..bashrc
file? Document this in the open source project compile instructions, probably only relevant for developers contributing to the project. The.bashrc
file could be source'd in the.profile
file.Beta Was this translation helpful? Give feedback.
All reactions