On 2022-02-13 at 23:16:12 +0100, Ingo Schmid wrote:
> Well, it is several machines for several users, not that many. We don't
> have formal admins and developers, we just do. It's called science. ;)
> And I have used it for years and this is one of the rare occasions where
> it causes troubles.
> 
> Out of curiosity, how do manage modules?

Hello Ingo,

I have put together a PR that should work around this specific issue so
that the tests pass: 
<https://github.com/PDLPorters/PDL-Graphics-Gnuplot/pull/82>.

As for managing modules, I use perlbrew + local::lib because I have to
test against various versions of Perl.

I have also been using <https://metacpan.org/pod/App::plx> lately to
easily switch between different combinations of Perl + Perl modules (but
have not used it as much as I would like to). This helps consolidate
uses of local::lib and Carton into a single command.

The tension between running tests as root and security is something that
can come up with other modules. For example, I have a module that I have
not yet put on CPAN that will never be testable as root since it
controls a GUI that uses Chromium internally and because Chromium has
a sandbox that refuses to run with root privileges, it exits before I
can run the tests.

Best regards,
- Zaki Mughal

> 
> Ingo
> 
> On 2/13/2022 10:11 PM, David Mertens wrote:
> > Ingo,
> >
> > It sounds like you are the system administrator for your machines?
> > That is the only situation in which I would consider using sudo cpanm.
> >
> > David
> >
> > On Sun, Feb 13, 2022 at 11:11 AM Ingo Schmid <ingo...@gmx.at> wrote:
> >
> >     Hi Ed,
> >
> >     I see what you mean. But then it is just me having access to those
> >     modules and not other users. Are you suggesting it is best
> >     practice to install perl modules per user? That requires a lot of
> >     redundant work if you have a group using the software.
> >
> >     I suppose in the particular case, catching an empty
> >     XDG_RUNTIME_DIR and setting to some temp directory would resolve
> >     the issue.
> >
> >     Best wishes Ingo
> >
> >     On 2/13/2022 2:26 PM, Ed . wrote:
> >>
> >>     Hi Ingo,
> >>
> >>      
> >>
> >>     cpanm is certainly the best tool for installing Perl modules! But
> >>     if you’re in a package-managed environment and want to use the
> >>     system Perl (which is understandable, it’s very stable), then
> >>     current best practice is to not install any non-package-managed
> >>     modules in the system location. Instead, you should use a
> >>     local::lib as Zaki said, so that your personally-installed
> >>     modules overlay any system ones. In particular, if you find
> >>     yourself using “sudo” to install Perl modules off CPAN, that is a
> >>     sign of poor practice.
> >>
> >>      
> >>
> >>     Another benefit of this strategy is that because you install
> >>     modules as your normal user, it has access to all your normal
> >>     environment. There are also security benefits.
> >>
> >>      
> >>
> >>     Best regards,
> >>
> >>     Ed
> >>
> >>      
> >>
> >>     *From: *Ingo Schmid <mailto:ingo...@gmx.at>
> >>     *Sent: *13 February 2022 09:09
> >>     *To: *Zakariyya Mughal <mailto:zaki.mug...@gmail.com>;
> >>     pdl-devel@lists.sourceforge.net
> >>     *Subject: *Re: [Pdl-devel] PDL::Graphics::Simple
> >>
> >>      
> >>
> >>     Hi Zaki,
> >>
> >>     thank you for the suggestion. Yes, that is exactly the issue. The
> >>     question to me is rather, if this is desired. Who runs an X
> >>     session as
> >>     root ?
> >>
> >>     Isn't using cpanm the way to maintain Perl modules these days? I will
> >>     open an issue and I have a hunch this could easily be caught
> >>     during build.
> >>
> >>     Ingo
> >>
> >>     On 2/12/2022 12:59 AM, Zakariyya Mughal wrote:
> >>     > On 2022-02-11 at 10:49:12 +0100, Ingo Schmid wrote:
> >>     >> Hi,
> >>     >>
> >>     >> the other mail made me aware of P:G:S, now I was doing
> >>     >>
> >>     >> #> sudo cpanm PDL::Graphics::Simple
> >>     >>
> >>     >> on Debian testing and during make test I received this error
> >>     after the
> >>     >> label plot is shown:
> >>     >>
> >>     >> Gnuplot error: "QStandardPaths: XDG_RUNTIME_DIR not set,
> >>     defaulting to
> >>     >> '/tmp/runtime-root'" while sending final multiplot command. at
> >>     >> /usr/local/share/perl/5.32.1/PDL/Graphics/Gnuplot.pm line
> >>     4346, <STDIN>
> >>     >> line 7.
> >>     >>     PDL::Graphics::Gnuplot::multiplot(undef, "layout",
> >>     >> ARRAY(0x55c8040dbb08)) called at
> >>     >>
> >>     
> >> /root/.cpanm/work/1644572352.1118703/PDL-Graphics-Simple-1.007/blib/lib/PDL/Graphics/Simple/Gnuplot.pm
> >>     >> line 360
> >>     >>
> >>      
> >> PDL::Graphics::Simple::Gnuplot::plot(PDL::Graphics::Simple::Gnuplot=HASH(0x55c8040e2378),
> >>     HASH(0x55c8040f5910), ARRAY(0x55c80410c888)) called at
> >>     
> >> /root/.cpanm/work/1644572352.1118703/PDL-Graphics-Simple-1.007/blib/lib/PDL/Graphics/Simple.pm
> >>     line 1044
> >>     >>
> >>      
> >> PDL::Graphics::Simple::plot(PDL::Graphics::Simple=HASH(0x55c8040ede58),
> >>     "with", "image", PDL=SCALAR(0x55c8040d3e58)) called at
> >>     
> >> /root/.cpanm/work/1644572352.1118703/PDL-Graphics-Simple-1.007/blib/lib/PDL/Graphics/Simple.pm
> >>     line 1127
> >>     >>     PDL::Graphics::Simple::_convenience_plot("image",
> >>     >> PDL::Graphics::Simple=HASH(0x55c8040ede58),
> >>     PDL=SCALAR(0x55c8040d3e58),
> >>     >> HASH(0x55c8040edae0), HASH(0x55c8040d3e88)) called at
> >>     >>
> >>     
> >> /root/.cpanm/work/1644572352.1118703/PDL-Graphics-Simple-1.007/blib/lib/PDL/Graphics/Simple.pm
> >>     >> line 1143
> >>     >>
> >>      
> >> PDL::Graphics::Simple::image(PDL::Graphics::Simple=HASH(0x55c8040ede58),
> >>     PDL=SCALAR(0x55c8040d3e58), HASH(0x55c8040edae0)) called at
> >>     t/simple.t line 145
> >>     >>
> >>     >> Have you got any ideas?
> >>     >> Ingo
> >>     >
> >>     > Hello Ingo,
> >>     >
> >>     > Since you are using `sudo` to install, it is using the root user's
> >>     > environment (actually a reduced environment that `sudo`
> >>     creates*) which
> >>     > does not have `XDG_RUNTIME_DIR` set. Gnuplot needs to have
> >>     > `XDG_RUNTIME_DIR` set in order to run during the dist's tests.
> >>     You can
> >>     > set the variable to a temporary directory:
> >>     >
> >>     >   sudo bash -c 'XDG_RUNTIME_DIR=$(mktemp -d) cpanm --test-only
> >>     PDL::Graphics::Simple'
> >>     >
> >>     > I would recommend installing packages to a `local::lib` instead
> >>     of using `sudo`.
> >>     >
> >>     > Best regards,
> >>     > - Zaki Mughal
> >>     >
> >>     > * Run `sudo env` to see what is set.
> >>     >
> >>     >> _______________________________________________
> >>     >> pdl-devel mailing list
> >>     >> pdl-devel@lists.sourceforge.net
> >>     >> https://lists.sourceforge.net/lists/listinfo/pdl-devel
> >>
> >>
> >>     _______________________________________________
> >>     pdl-devel mailing list
> >>     pdl-devel@lists.sourceforge.net
> >>     https://lists.sourceforge.net/lists/listinfo/pdl-devel
> >>
> >>      
> >>
> >     _______________________________________________
> >     pdl-devel mailing list
> >     pdl-devel@lists.sourceforge.net
> >     https://lists.sourceforge.net/lists/listinfo/pdl-devel
> >
> >
> >
> > --
> >  "Debugging is twice as hard as writing the code in the first place.
> >   Therefore, if you write the code as cleverly as possible, you are,
> >   by definition, not smart enough to debug it." -- Brian Kernighan


_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel

Reply via email to