Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #201: RPC_PMAP_FAILURE


comp / comp.text.tex / [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?

SubjectAuthor
* [LaTeX] How to tell the user that the document wasn't compiled with -shell-escapAnnada Behera
+- Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-eUlrich D i e z
`* Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-eStefan Ram
 +- Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-eUlrich D i e z
 `- Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-eAnnada Behera

1
Subject: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?
From: Annada Behera
Newsgroups: comp.text.tex
Organization: tilde.green
Date: Thu, 22 Aug 2024 12:35 UTC
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.quux.org!tilde.green!.POSTED.103.160.128.7!not-for-mail
From: segfault@tilde.green (Annada Behera)
Newsgroups: comp.text.tex
Subject: [LaTeX] How to tell the user that the document wasn't compiled with
-shell-escape flag?
Date: Thu, 22 Aug 2024 18:05:25 +0530
Organization: tilde.green
Sender: segfault@tilde.green
Message-ID: <e232066edde4e56c00ea54acc8608b61eca65278.camel@tilde.green>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: tilde.green; posting-account="segfault@tilde.green"; posting-host="103.160.128.7";
logging-data="2847621"; mail-complaints-to="admins@tilde.green"
User-Agent: Evolution 3.52.2
View all headers

Hi,

I am writing a LaTeX package and it invokes external Python code to do
some heavy preprocessing. I have not learned TeX programming language
enough yet to do everything in TeX. So, when the user of my package
doesn't invoke pdflatex with the -shell-escape flag, I would like print
a helpful error message telling them so.

Anybody has any idea how that can be done. Thank you.

Annada

Subject: Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?
From: Ulrich D i e z
Newsgroups: comp.text.tex
Date: Thu, 22 Aug 2024 15:24 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ud.usenetcorrespondence@web.de (Ulrich D i e z)
Newsgroups: comp.text.tex
Subject: Re: [LaTeX] How to tell the user that the document wasn't compiled
with -shell-escape flag?
Date: Thu, 22 Aug 2024 17:24:21 +0200
Message-ID: <va7l76$1ic1p$1@solani.org>
References: <e232066edde4e56c00ea54acc8608b61eca65278.camel@tilde.green>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 22 Aug 2024 15:24:22 -0000 (UTC)
Injection-Info: solani.org;
logging-data="1650745"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:IjiJUWx2FmsxgG791t+pKYVyqfs=
In-Reply-To: <e232066edde4e56c00ea54acc8608b61eca65278.camel@tilde.green>
Content-Language: en-US
X-User-ID: eJwVxsERACEIBLCWUGDBcpBh+y/hzk8mrljoMDjM6VyjT55/XjZQgW1eRQalmB2ZWTJ9u+zoByNQEW8=
View all headers

Annada Behera schrieb:

> Hi,
>
> I am writing a LaTeX package and it invokes external Python code to do
> some heavy preprocessing. I have not learned TeX programming language
> enough yet to do everything in TeX. So, when the user of my package
> doesn't invoke pdflatex with the -shell-escape flag, I would like print
> a helpful error message telling them so.
>
> Anybody has any idea how that can be done. Thank you.
>
> Annada

I recommend using the package shellesc (https://ctan.org/pkg/shellesc)
as it provides a unified shell escape interface which works out both
with traditional TeX engines where \write18 is available and with TeX
engines based on LuaTeX which don't have \write18 and instead provide
the function os.execute .

With that package you can query the \write18-status via \ShellEscapeStatus.

The package manual plus implementation, where you can learn how
\ShellEscapeStatus is defined, is at
http://mirrors.ctan.org/macros/latex/required/tools/shellesc.pdf .

Sincerely

Ulrich

Subject: Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?
From: Stefan Ram
Newsgroups: comp.text.tex
Organization: Stefan Ram
Date: Thu, 22 Aug 2024 20:02 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.text.tex
Subject: Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?
Date: 22 Aug 2024 20:02:40 GMT
Organization: Stefan Ram
Lines: 20
Expires: 1 Jul 2025 11:59:58 GMT
Message-ID: <Status-20240822205836@ram.dialup.fu-berlin.de>
References: <e232066edde4e56c00ea54acc8608b61eca65278.camel@tilde.green>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de Yvy+Xr0bLkAt0K/JltaVpwYQRdm3jt4/EVYChNLXiDJWRJ
Cancel-Lock: sha1:gqAGX/w3BQbOrfnsBkVrgfXOzSg= sha256:JYGAvTUV68dIzXjV7MhEy3xlnVuQBSdl2yTtQ4OxHBI=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
View all headers

Annada Behera <segfault@tilde.green> wrote or quoted:
>Anybody has any idea how that can be done. Thank you.

Lately, the newer versions of "shellesc" (like since 2020?)
are said to define "ShellEscapeStatus." So, you could totally
do something like this:

\usepackage{shellesc}

\ifnum\ShellEscapeStatus=1 \else
\PackageError{mypackage}{use shell escape}{or else}
\fi

But since I'm rocking an older version, I can't check this out
myself!

|The shell escape status may be queried by checking the
|integer (chardef) command \ShellEscapeStatus, 0 (disabled) 1
|(enabled) 2 (restricted).
probably from the docs (2023)

Subject: Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?
From: Ulrich D i e z
Newsgroups: comp.text.tex
Date: Fri, 23 Aug 2024 00:35 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ud.usenetcorrespondence@web.de (Ulrich D i e z)
Newsgroups: comp.text.tex
Subject: Re: [LaTeX] How to tell the user that the document wasn't compiled
with -shell-escape flag?
Date: Fri, 23 Aug 2024 02:35:25 +0200
Message-ID: <va8lge$1j9de$1@solani.org>
References: <e232066edde4e56c00ea54acc8608b61eca65278.camel@tilde.green>
<Status-20240822205836@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 23 Aug 2024 00:35:26 -0000 (UTC)
Injection-Info: solani.org;
logging-data="1680814"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:ZPRHpgTCKJ5/Lkzrb52NgyeCJPY=
X-User-ID: eJwNycEBwEAEBMCWOOxKOUfov4RkvhMGRdMR8NhY5VSW2nNC9g8Sxdtc95TXOwV2p2dPJkv7AxQ7EQ8=
In-Reply-To: <Status-20240822205836@ram.dialup.fu-berlin.de>
Content-Language: de-DE
View all headers

Stefan Ram wrote:

> Annada Behera <segfault@tilde.green> wrote or quoted:
>>Anybody has any idea how that can be done. Thank you.
>
> Lately, the newer versions of "shellesc" (like since 2020?)

shellesc.dtx says the command \ShellEscapeStatus is a TeX <number>
quantity of the kind \chardef-token and was introduced in
version v1.0a of the shellesc package, released 2019/10/13 .

\ShellEscapeStatus is defined by the following lines:

\chardef\ShellEscapeStatus
\ifx\pdfshellescape\@undefined
\ifx\shellescape\@undefined
\ifx\directlua\@undefined
\z@
\else
\directlua{%
tex.sprint((status.shell_escape or os.execute()) .. " ")}
\fi
\else
\shellescape
\fi
\else
\pdfshellescape
\fi

You also find an example for querying which does with \ifcase:

\ifcase\ShellEscapeStatus
\PackageWarning{shellesc}{Shell escape disabled}
\or
\PackageInfo {shellesc}{Unrestricted shell escape enabled}
\else
\PackageInfo {shellesc}{Restricted shell escape enabled}
\fi

> are said to define "ShellEscapeStatus." So, you could totally
> do something like this:
>
> \usepackage{shellesc}
>
> \ifnum\ShellEscapeStatus=1 \else
> \PackageError{mypackage}{use shell escape}{or else}
> \fi

If you neither want to load the package nor want to define the
chardef-token you can do s.th. like

\makeatletter
\ifcase
\ifx\pdfshellescape\@undefined
\ifx\shellescape\@undefined
\ifx\directlua\@undefined
\z@
\else
\directlua{%
tex.sprint((status.shell_escape or os.execute()) .. " ")}
\fi
\else
\shellescape
\fi
\else
\pdfshellescape
\fi
\PackageWarning{shellesc}{Shell escape disabled}
\or
\PackageInfo {shellesc}{Unrestricted shell escape enabled}
\else
\PackageInfo {shellesc}{Restricted shell escape enabled}
\fi
\makeatother

> But since I'm rocking an older version, I can't check this out
> myself!

For checking out you can
- look at the documentation of most recent releases of packages at CTAN.
- test with a rathher recent TeX Live release via Overleaf -
https://de.overleaf.com/
- try the test page (https://texlive.net/run)" rel="nofollow" target="_blank">https://texlive.net/run) of the
The TeXLive.net Server, https://texlive.net/ .

Ulrich

Subject: Re: [LaTeX] How to tell the user that the document wasn't compiled with -shell-escape flag?
From: Annada Behera
Newsgroups: comp.text.tex
Organization: tilde.green
Date: Fri, 23 Aug 2024 05:45 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.quux.org!tilde.green!.POSTED.103.160.128.7!not-for-mail
From: segfault@tilde.green (Annada Behera)
Newsgroups: comp.text.tex
Subject: Re: [LaTeX] How to tell the user that the document wasn't compiled
with -shell-escape flag?
Date: Fri, 23 Aug 2024 11:15:33 +0530
Organization: tilde.green
Sender: segfault@tilde.green
Message-ID: <ca07e0ad9e5f165e3a0d22e58b703f9bb710d198.camel@tilde.green>
References: <e232066edde4e56c00ea54acc8608b61eca65278.camel@tilde.green>
<Status-20240822205836@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: tilde.green; posting-account="segfault@tilde.green"; posting-host="103.160.128.7";
logging-data="3025112"; mail-complaints-to="admins@tilde.green"
User-Agent: Evolution 3.52.2
In-Reply-To: <Status-20240822205836@ram.dialup.fu-berlin.de>
View all headers

On Thu, 2024-08-22 at 20:02 +0000, Stefan Ram wrote:
>   But since I'm rocking an older version, I can't check this out
>   myself!

I wonder how many people are still using the older version of texlive. I
don't know why texlive can't have rolling or LTS version. Need to
downloading a 5 GiB iso file and install it every year. Gets old very
fast.

1

rocksolid light 0.9.8
clearnet tor