2

what I want to do is to be able to mount via sshfs some files on the mainframe via USS on my local PC. I can do that but sshfs doesnt do straight off the conversion from EBCDIC to ascii/unicode. Is there any flags that i can set.

Alternativly, does anybody know of a library that does EBCDIC to ASCII conversions so i can add to SSHFS?

Cheers

Mark

sigjuice
  • 28,661
  • 12
  • 68
  • 93
Mark Lakewood
  • 1,980
  • 4
  • 22
  • 44
  • 2
    o_O EBCDIC is still being used? Over fuse/sshfs? Wow... – Brian Campbell Apr 03 '09 at 05:37
  • @Brian, EBCDIC is still in use on the System z (big honkin' IBM mainframe) and they're still used a *lot*. And USS is UNIX for z which uses EBCDIC (lots of packages won't compile since they assume ASCII) - zLinux is the way to go, RHEL/SLES running on the mainframe (10,000 instances in our tests). – paxdiablo Apr 03 '09 at 06:14

3 Answers3

4

Be aware though that transparent charset conversion is a very dangerous game. Are you absolutely sure that you will never read anything but EBCDIC files via SSHFS? What if there is binary data?

Some systems used transparent conversions in the past:

  • the infamous "ASCII mode" of FTP, which messed up many binary downloads
  • the vfat filesystem in Linux, which notes: "Programs that do computed lseeks won't like in-kernel text conversion. Several people have had their data ruined by this translation. Beware!"

So I'd strongly advise to be aware of the consequences.

Why not use use an editor that can handle EBCDIC? Vim e.g. can do it (if it is compiled in).

sleske
  • 81,358
  • 34
  • 189
  • 227
1

I know a lot of time has passed since the original question but I'll leave the info here:
I've wrote a patch for sshfs which adds automatic conversion between ASCII and EBCDIC. It can be found here: https://github.com/vadimshchukin/sshfs-ebcdic

The patch adds "-t" command-line option which defines regular expression for files that should be converted. For example sshfs -t".*" defines conversion for all files.

I had to "hard-code" the conversion table since there are various "flavours" of EBCDIC and iconv didn't translate the text between ASCII as EBCDIC on my system as needed. The advantage here is that someone can easily change that translation table as needed.

By the way I wrote the same patch for win-sshfs.

1

There are several libraries for character set conversion — iconv (normally part of your C library; see for example iconv_open) and GNU recode come to mind.

derobert
  • 49,731
  • 15
  • 94
  • 124