Re: [Pkg-javascript-devel] help understanding autopkgtest failures for node-eslint-visitor-keys

2022-02-28 Thread Jonas Smedegaard
Quoting Nilesh Patra (2022-02-28 22:52:20)
> On 3/1/22 2:34 AM, Jonas Smedegaard wrote:
> >> Simple solution is to create a temporary dir; or use 
> >> $AUTOPKGTEST_TMP (latter is best)
> >>
> >> I have attached a patch that fixes this, please apply and upload.
> >>
> >> Hope that helps.
> > 
> > Thanks, very helpful.
> > 
> > Do you happen to know where this behaviour is documented upstream?
> 
> Unfortunately not. Actually, a few months back, I saw this in another 
> package (IIRC, that was yours too) I just fiddled around a bit and 
> found out back then.

Ah, that was you as well?

I remember having noticed that trick with $AUTOPKGTEST_TMP before, just 
didn't know (or remember) exactly what it was solving.


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature
-- 
Pkg-javascript-devel mailing list
Pkg-javascript-devel@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel


Re: [Pkg-javascript-devel] help understanding autopkgtest failures for node-eslint-visitor-keys

2022-02-28 Thread Nilesh Patra

On 3/1/22 2:34 AM, Jonas Smedegaard wrote:

Simple solution is to create a temporary dir; or use $AUTOPKGTEST_TMP
(latter is best)

I have attached a patch that fixes this, please apply and upload.

Hope that helps.


Thanks, very helpful.

Do you happen to know where this behaviour is documented upstream?


Unfortunately not. Actually, a few months back, I saw this in another package 
(IIRC, that was yours too)
I just fiddled around a bit and found out back then.

I "guess" it might not be even documented since AFAICS, the usual upstream way 
of vendoring
npm/yarn modules would not do a 'require' locally w/o building the package, 
'within the source code itself'
that'd be quite unusual to do.

The way it happens in debian with ('/usr/share' ; '/usr/lib/') especially with 
the autopkgtest environment
is somewhat special/different.


I ask because I experience another possibly similar error with failure
locating chai for node-eslint-visitor-keys 3.3.0+~0.0.51, where it is
not an option to switch directory.


I think in such a case you can do either:

a) Remove package.json/interfering stuff in autopkgtest environment and then 
run a 'require'
b) Copy relevant/required files/dirs to $AUTOPKGTEST_TMP, change directory and 
then do a 'require' there

Hope that helps again.

Regards,
Nilesh



OpenPGP_signature
Description: OpenPGP digital signature
-- 
Pkg-javascript-devel mailing list
Pkg-javascript-devel@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel


Re: [Pkg-javascript-devel] help understanding autopkgtest failures for node-eslint-visitor-keys

2022-02-28 Thread Jonas Smedegaard
Quoting Nilesh Patra (2022-02-28 19:21:07)
> On 2/28/22 3:01 PM, Jonas Smedegaard wrote:
> > Currently, autopkgtest fails for node-eslint-visitor-keys and I cannot
> > figure out why.
> > 
> > I would be happy if others could have a look and maybe help spot why it
> > fails.
> > [...]
> 
> > Error: Cannot find module 
> > '/tmp/autopkgtest-lxc.w0404gv_/downtmp/build.H9q/src/dist/eslint-visitor-keys.cjs'
> >  at createEsmNotFoundErr (internal/modules/cjs/loader.js:842:15)
> >  at finalizeEsmResolution (internal/modules/cjs/loader.js:835:15)
> ^^
> 
> As you might have noticed above, it tries to find dist/ in 
> the local autopkgtest directory instead of global one (/usr/share/)
> 
> This happens because you are running the test in the same directory 
> where your source code is and the "local" package.json is interfering 
> with your "require" command.
> 
> Simple solution is to create a temporary dir; or use $AUTOPKGTEST_TMP 
> (latter is best)
> 
> I have attached a patch that fixes this, please apply and upload.
> 
> Hope that helps.

Thanks, very helpful.

Do you happen to know where this behaviour is documented upstream?

I ask because I experience another possibly similar error with failure 
locating chai for node-eslint-visitor-keys 3.3.0+~0.0.51, where it is 
not an option to switch directory.


> > The package does _not_ use pkg-js-tools.
> 
> Had you used this, it'd have passed since it does the change to temp 
> dir thing by default

That's good to know, for packages using pkg-js-tools.


> > Works fine interactively in a local pristine chroot with only nodejs 
> > and node-eslint-visitor-keys installed.
> 
> I hope you run the autopkgtest in a schroot/container and were able to 
> reproduce it?

Not sure what you mean to say here.  I use a pbuilder chroot, and as I 
wrote I was unable to reproduce it - thanks to your explanation I now 
know why: interactive access and scripted access are not same 
environment with pbuilder.


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature
-- 
Pkg-javascript-devel mailing list
Pkg-javascript-devel@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel


Re: [Pkg-javascript-devel] help understanding autopkgtest failures for node-eslint-visitor-keys

2022-02-28 Thread Nilesh Patra

On 2/28/22 3:01 PM, Jonas Smedegaard wrote:

Currently, autopkgtest fails for node-eslint-visitor-keys and I cannot
figure out why.

I would be happy if others could have a look and maybe help spot why it
fails.
[...]



Error: Cannot find module 
'/tmp/autopkgtest-lxc.w0404gv_/downtmp/build.H9q/src/dist/eslint-visitor-keys.cjs'
 at createEsmNotFoundErr (internal/modules/cjs/loader.js:842:15)
 at finalizeEsmResolution (internal/modules/cjs/loader.js:835:15)

^^

As you might have noticed above, it tries to find dist/ in the local 
autopkgtest directory
instead of global one (/usr/share/)

This happens because you are running the test in the same directory where your 
source code is and
the "local" package.json is interfering with your "require" command.

Simple solution is to create a temporary dir; or use $AUTOPKGTEST_TMP (latter 
is best)

I have attached a patch that fixes this, please apply and upload.

Hope that helps.


The package does _not_ use pkg-js-tools.


Had you used this, it'd have passed since it does the change to
temp dir thing by default


Works fine interactively in a local pristine chroot with only nodejs and
node-eslint-visitor-keys installed.


I hope you run the autopkgtest in a schroot/container and were able to 
reproduce it?
diff --git a/debian/tests/control b/debian/tests/control
index b79f387..62d654b 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,4 +1,4 @@
-Test-Command: node -e "require('eslint-visitor-keys');"
+Test-Command: cd $AUTOPKGTEST_TMP && node -e "require('eslint-visitor-keys');"
 Depends:
  node-eslint-visitor-keys,
  nodejs,


OpenPGP_signature
Description: OpenPGP digital signature
-- 
Pkg-javascript-devel mailing list
Pkg-javascript-devel@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel


[Pkg-javascript-devel] help understanding autopkgtest failures for node-eslint-visitor-keys

2022-02-28 Thread Jonas Smedegaard
Hi,

Currently, autopkgtest fails for node-eslint-visitor-keys and I cannot 
figure out why.

I would be happy if others could have a look and maybe help spot why it 
fails.

The package does _not_ use pkg-js-tools.

The test is this minimal command:

  node -e "require('eslint-visitor-keys');"

Works fine interactively in a local pristine chroot with only nodejs and 
node-eslint-visitor-keys installed.

Fails on Debian servers with this error:

internal/modules/cjs/loader.js:406
throw e;
^

Error: Cannot find module 
'/tmp/autopkgtest-lxc.w0404gv_/downtmp/build.H9q/src/dist/eslint-visitor-keys.cjs'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:842:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:835:15)
at trySelf (internal/modules/cjs/loader.js:400:12)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:24)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at [eval]:1:1
at Script.runInThisContext (vm.js:120:18)
at Object.runInThisContext (vm.js:309:38) {
  code: 'MODULE_NOT_FOUND',
  path: '/tmp/autopkgtest-lxc.w0404gv_/downtmp/build.H9q/src/package.json'
}


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature
-- 
Pkg-javascript-devel mailing list
Pkg-javascript-devel@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel