[Pkg-javascript-devel] Bug#1067283: node-yarnpkg: FTBFS: compat.h:155:2: error: unsupported size of off_t

Zixing Liu zixing.liu at canonical.com
Thu Jun 27 23:24:16 BST 2024


Package: node-yarnpkg
Version: 4.0.2+dfsg-2
Followup-For: Bug #1067283
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu oracular ubuntu-patch
Control: tags -1 patch ftbfs

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * d/rules: add a few LDFLAGS flags to workaround a bug in the Debian
    Emscripten toolchain. Also remove some flags to avoid wasm-ld crashing
    (LP: #2068769).
  * d/p/fix-yarnpkg-libzip.patch: modify the patch so that it will not add
    in unsupported Node.js options that got removed and stablized in Node.js 20
  * d/p/disable-network-tests.patch: remove a test that requires Internet
    to run properly


Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers noble-updates
  APT policy: (500, 'noble-updates'), (500, 'noble-security'), (500, 'noble'), (100, 'noble-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.8.0-35-generic (SMP w/10 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru node-yarnpkg-4.0.2+dfsg/debian/patches/disable-network-tests.patch node-yarnpkg-4.0.2+dfsg/debian/patches/disable-network-tests.patch
--- node-yarnpkg-4.0.2+dfsg/debian/patches/disable-network-tests.patch	1969-12-31 17:00:00.000000000 -0700
+++ node-yarnpkg-4.0.2+dfsg/debian/patches/disable-network-tests.patch	2024-06-17 12:52:18.000000000 -0600
@@ -0,0 +1,139 @@
+Description: Disable network tests
+ We can't reliably test those during the build as the build environment
+ does not have Internet connection.
+Author: Zixing Liu <zixing.liu at canonical.com>
+Forwarded: not-needed
+Last-Update: 2024-06-19
+---
+Index: node-yarnpkg/packages/plugin-compat/tests/patches.test.ts
+===================================================================
+--- node-yarnpkg.orig/packages/plugin-compat/tests/patches.test.ts
++++ /dev/null
+@@ -1,127 +0,0 @@
+-import {Configuration, Descriptor, Project, ResolveOptions, ThrowReport, structUtils, Locator, Cache, LocatorHash} from '@yarnpkg/core';
+-import {PortablePath, xfs, ppath}                                                                                  from '@yarnpkg/fslib';
+-import NpmPlugin                                                                                                   from '@yarnpkg/plugin-npm';
+-import PatchPlugin                                                                                                 from '@yarnpkg/plugin-patch';
+-
+-import CompatPlugin                                                                                                from '../sources/index';
+-
+-function getConfiguration(p: PortablePath) {
+-  return Configuration.create(p, p, new Map([
+-    [`@yarnpkg/plugin-compat`, CompatPlugin],
+-    [`@yarnpkg/plugin-npm`, NpmPlugin],
+-    [`@yarnpkg/plugin-patch`, PatchPlugin],
+-  ]));
+-}
+-
+-async function createProject(configuration: Configuration, p: PortablePath, manifest: object = {}) {
+-  await xfs.writeFilePromise(ppath.join(p, `package.json`), JSON.stringify(manifest));
+-
+-  return Project.find(configuration, p);
+-}
+-
+-async function getDescriptorCandidates(descriptor: Descriptor) {
+-  return await xfs.mktempPromise(async dir => {
+-    const configuration = getConfiguration(dir);
+-    const {project} = await createProject(configuration, dir);
+-
+-    const resolver = configuration.makeResolver();
+-    const resolveOptions: ResolveOptions = {project, resolver, report: new ThrowReport()};
+-
+-    const normalizedDescriptor = configuration.normalizeDependency(descriptor);
+-    const candidates = await resolver.getCandidates(normalizedDescriptor, {}, resolveOptions);
+-
+-    return candidates;
+-  });
+-}
+-
+-/**
+- * A Set used to keep track of the test candidates, so we only test each candidate once.
+- */
+-const testedCandidates: Set<LocatorHash> = new Set();
+-
+-async function testCandidate(locator: Locator) {
+-  if (testedCandidates.has(locator.locatorHash))
+-    return;
+-
+-  testedCandidates.add(locator.locatorHash);
+-
+-  await xfs.mktempPromise(async dir => {
+-    const configuration = getConfiguration(dir);
+-    const {project} = await createProject(configuration, dir, {
+-      dependencies: {
+-        [structUtils.stringifyIdent(locator)]: locator.reference,
+-      },
+-    });
+-    const cache = await Cache.find(configuration);
+-
+-    await project.resolveEverything({
+-      cache,
+-      lockfileOnly: false,
+-      report: new ThrowReport(),
+-    });
+-
+-    let error: Error | null = null;
+-
+-    try {
+-      await project.fetchEverything({
+-        cache,
+-        report: new ThrowReport(),
+-      });
+-    } catch (e) {
+-      error = e;
+-    }
+-
+-    if (error) {
+-      expect(error.message).not.toContain(`Cannot apply hunk`);
+-    }
+-  });
+-}
+-
+-const TEST_TIMEOUT = 100000000;
+-
+-const TEST_RANGES: Array<[string, Array<string>]> = [
+-  [
+-    `fsevents`, [
+-      `^1`,
+-      `^2.1`,
+-      `latest`,
+-    ],
+-  ], [
+-    `resolve`, [
+-      `>=1.9`,
+-      `latest`,
+-      `next`,
+-    ],
+-  ], [
+-    `typescript`, [
+-      `>=3.2`,
+-      `latest`,
+-      `next`,
+-    ],
+-  ],
+-];
+-
+-describe(`patches`, () => {
+-  describe.each(TEST_RANGES)(`%s`, (stringifiedIdent, ranges) => {
+-    const ident = structUtils.parseIdent(stringifiedIdent);
+-
+-    it.each(ranges)(`should work with ${stringifiedIdent}@%s`, async range => {
+-      const descriptor = structUtils.makeDescriptor(ident, range);
+-      const candidates = await getDescriptorCandidates(descriptor);
+-
+-      const errors = [];
+-
+-      for (const candidate of candidates) {
+-        try {
+-          await testCandidate(candidate);
+-        } catch (error) {
+-          errors.push(`--- ${structUtils.stringifyLocator(candidate)} ---\n${error.stack}`);
+-        }
+-      }
+-
+-      if (errors.length > 0) {
+-        throw new Error(errors.join(`\n`));
+-      }
+-    }, TEST_TIMEOUT);
+-  });
+-});
diff -Nru node-yarnpkg-4.0.2+dfsg/debian/patches/fix-yarnpkg-libzip.patch node-yarnpkg-4.0.2+dfsg/debian/patches/fix-yarnpkg-libzip.patch
--- node-yarnpkg-4.0.2+dfsg/debian/patches/fix-yarnpkg-libzip.patch	2023-12-10 04:08:15.000000000 -0700
+++ node-yarnpkg-4.0.2+dfsg/debian/patches/fix-yarnpkg-libzip.patch	2024-06-17 12:52:18.000000000 -0600
@@ -90,7 +90,7 @@
 -    -DZLIB_INCLUDE_DIR=/zlib/build/local/include \
 +    -DZLIB_LIBRARY="$ZLIB_ROOT/build/local/lib/libz.a" \
 +    -DZLIB_INCLUDE_DIR="$ZLIB_ROOT/build/local/include" \
-+    -DCMAKE_CROSSCOMPILING_EMULATOR="/usr/bin/node;--experimental-wasm-threads;--no-experimental-fetch" \
++    -DCMAKE_CROSSCOMPILING_EMULATOR="/usr/bin/node" \
      ..
  
 -  docker run --rm \
diff -Nru node-yarnpkg-4.0.2+dfsg/debian/patches/series node-yarnpkg-4.0.2+dfsg/debian/patches/series
--- node-yarnpkg-4.0.2+dfsg/debian/patches/series	2023-12-10 04:08:15.000000000 -0700
+++ node-yarnpkg-4.0.2+dfsg/debian/patches/series	2024-06-17 12:52:18.000000000 -0600
@@ -17,3 +17,4 @@
 fix-yarnpkg-pnp.patch
 fix-arcanis-libzip.patch
 fix-zlib-ng.patch
+disable-network-tests.patch
diff -Nru node-yarnpkg-4.0.2+dfsg/debian/rules node-yarnpkg-4.0.2+dfsg/debian/rules
--- node-yarnpkg-4.0.2+dfsg/debian/rules	2023-12-10 03:28:02.000000000 -0700
+++ node-yarnpkg-4.0.2+dfsg/debian/rules	2024-06-17 12:52:18.000000000 -0600
@@ -4,6 +4,9 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+export DEB_LDFLAGS_MAINT_STRIP  = -Wl,-Bsymbolic-functions
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,--export-if-defined=main -Wl,--export-if-defined=__main_argc_argv
+
 %:
 	dh $@
 


More information about the Pkg-javascript-devel mailing list