Bug#886024: split off anything-el related part
On Wed, Jan 3, 2018, at 03:45, H.-Dirk Schmitt wrote: > On Mi, 2018-01-03 at 02:06 +0200, era eriksson wrote: > > Code outline for an emacs batch wrapper > > I do not insist on bash – you are free to fix it in any programming > language ;-) A fair amont of work has gone into making the core system work without Bash. If you want this proposal to succeed, it woud seem important to demonstrate a good understanding of the surrounding system and the needs of our users. I'll be happy to try to convert this script into POSIX sh or at least Dash-compatible code if the maintainers agree that this is a good way forward, but so far, my impression is that they are unconvinced, or perhaps just waiting to see if this evolves into a serious proposal. The compilation bug you originally reported does not seem to affect other users, and at least I am still wondering if there is a way to trigger it which is likely to happen again. However, I think it would be useful to improve package compilation, with an eye towards making bug reporting easier and eventually somewhat more scriptable, perhaps with some way for Ubuntu's Apport system and eventually even some Debian-native replacement to hook in and fetch logs etc. I'm just thinking out loud here; sorry if this comes across as a rant. /* era */ -- If this were a real .signature, it would suck less. Well, maybe not.
Bug#886024: split off anything-el related part
On Mi, 2018-01-03 at 02:06 +0200, era eriksson wrote: > Code outline for an emacs batch wrapper I do not insist on bash – you are free to fix it in any programming language ;-) -- Signature H.-Dirk Schmitt H.-Dirk Schmitt Dipl.Math. eMail:dirk.schm...@computer42.org mobile:+49 177 616 8564 phone: +49 2642 99 41 14 fax: +49 2642 99 41 15 Schillerstr. 42, D-53489 Sinzig pgp: http://www.computer42.org/~dirk/OpenPGP-fingerprint.html
Bug#886024: split off anything-el related part
Your emacs-batch script seems to have some issues. I have not reviewed it properly, but e.g. your prevalent use of the declare keyword is definitely a bashism. More generally, making Emacs package compilation more robust is absolutely not a bad idea; but introducing new requirements should also be reflected in the Emacs policy (though honestly not sure what its current status is?) On Tue, Jan 2, 2018, at 22:34, H.-Dirk Schmitt wrote: > Here a simple wrapper script would help to : > - avoid copy and paste errors > - simplify the fix of this bug > - simple reuse > > > Code outline for an emacs batch wrapper > > > Assume a bash script *emacs_batch* replacing the `-q --batch` options.> It > should take as 1st option the emacs flavour (e.g. emacs25) and pass> trough > all other options except `-q`, > `--no-init-file` (alias to `-q`) and `--batch`. > > The emacs call could be implemented in this way: > > ``` > declare -r catchFile=$(mktemp) # create temporary > file> for output Exit on failure; $(mktemp) || exit > trap rm --force ${catchFile}# and ensure cleanup The trap declaration seems to be wrong (the trap code needs to be a single string and you need to specify which signals and conditions to trap on). > ${FLAVOUR} --batch "${cmdlineOptions[@]}" &>"${catchFile}" & # > fork> declare -i emacsPid=$! # and remember > sleep ${emacsTimeOut} & # fork timeout watch > declare -i sleepPid=$! # and remember > wait -n ${emacsPid} ${sleepPid} # -n → wait for the > next ending job > declare -r rc=$?# don't forget the > exit> code > if ! $(kill ${sleepPid}) The command substitution is fishy too.I guess you mean simply if ! kill $sleepPid or do you actually expect kill to print something? > then# oops run in timeout> > … add error handling here > else# emacs terminates > without timeout >cat ${catchFile} # forward console >output>exit ${rc} # rc is > originating >from> emacs > fi > ``` > > /* era */ -- If this were a real .signature, it would suck less. Well, maybe not.