Score:0

Problem with shar on Ubuntu on text files

cn flag

I am trying to produce a shar file with contents kept in the clear text inside the shar-file. For the most of it things work fine, but today I met a fairly strange problem:

When I do shar -T test.tex > file.shar on the one-liner file, encoded in UTF-8:

\chapter{Séries}

everything works fine, and when executing sh file.shar the file is extracted fine and it is the same as before.

Adding a one line to it and turning the file into:

\chapter{Séries}
Séries de potências são essenciais no estudo das funções.

the same command produces a shar file that contains the text. But when we execute sh (or unshar, or change it into an executable file and execute it) it fails the MD5 check upon extraction:

$ sh file.shar
x - created lock directory _sh06764.
x - extracting test.tex (text)
test.tex: MD5 check failed
x - removed lock directory _sh06764.

and it produces a file that is recognized as ISO-8859 text and it has all accents messed up, as in:

\chapter{Séries}
S©ries de potências são essenciais no estudo das funções.

I know the manual says that you may have problems e-mailing files produced with the -T flag, but this goes beyond mailing -- the file itself is corrupted.

Can anyone share a light on what is going on?

FedKad avatar
cn flag
I don't know if this is a bug or not, but I would use the mixed (`-M`) or binary (`-B`) option of `shar` instead of the text (`-T`) option for non-ASCII files.
hr flag
as per the man page's description of the `-T` option, *"If you have files with non-ascii bytes or text that some mail handling programs do not like, you may find difficulties."*
TeX Apprentice avatar
cn flag
@FedonKadifeli both `-M` and `-B` produce include the files in NON editable format (uuencoded).
TeX Apprentice avatar
cn flag
@steeldriver The phrase seems obviously written to mean _...you may find difficulties MAILING the file_. It says right after that _However, if you are using FTP or SSH/SCP, the non-conforming text files should be okay._ I want to edit them with vi or emacs, so there should be no problem.
FedKad avatar
cn flag
Why do you need to edit a `.shar` file? This seems to me like an https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
TeX Apprentice avatar
cn flag
@FedonKadifeli It is a extremely useful tool when you need to examine an occurrence before committing to an edit. You can just open the editor on the (shar) file and then look for each occurrence before doing a replacement...but my point here is not my purpose -- it is a BUG on the shar/unshar procedure -- even if you want to ftp and scp the files.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.