Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with ignoreShebang #163

Closed
aztech55 opened this issue Dec 16, 2023 · 3 comments
Closed

problem with ignoreShebang #163

aztech55 opened this issue Dec 16, 2023 · 3 comments

Comments

@aztech55
Copy link

Describe the bug
Hello!
I am using home-gallery which depends on exiftools-vendored.
I belive that ignoreShebang property when set to true is not working as it should.

To Reproduce

  1. /usr/bin/perl must not exist
  2. Using this test, we should get: exiftools object, exiftools version or rejection error.
ExifTool = require("exiftool-vendored").ExifTool;
exiftool = new ExifTool({ taskTimeoutMillis: 5000 }); 
console.log(exiftool);
exiftool.version().then(ver => { 
        console.log(`*****VERSION: ${ver}`); 
        exiftool.end();
    }, rej => { 
        console.log(`*****REJECT: ${rej}`);
     }).catch(err => console.log(`***** CATCH: ${err}`));

root@MyCloudEX2Ultra home-gallery # node -e 'ExifTool = require("exiftool-vendored").ExifTool;     exiftool = new ExifTool({ taskTimeoutMillis: 5000 });      console.log(exiftool);     exiftool.version().then(ve
r => {              console.log(`*****VERSION: ${ver}`);              exiftool.end();         }, rej => {              console.log(`*****REJECT: ${rej}`);          }).catch(err => console.log(`***** CATCH: ${err
}`));'
ExifTool {
  on: [Function (anonymous)],
  options: {
    maxProcs: 1,
    maxProcAgeMillis: 300000,
    onIdleIntervalMillis: 2000,
    maxReasonableProcessFailuresPerMinute: 10,
    spawnTimeoutMillis: 30000,
    minDelayBetweenSpawnMillis: 1500,
    taskTimeoutMillis: 5000,
    maxTasksPerProcess: 500,
    endGracefulWaitTimeMillis: 500,
    streamFlushMillis: 30,
    cleanupChildProcs: true,
    maxIdleMsPerProcess: 0,
    maxFailedTasksPerProcess: 2,
    healthCheckIntervalMillis: 30000,
    pidCheckIntervalMillis: 120000,
    logger: [Function: logger],
    taskRetries: 1,
    exiftoolPath: '/mnt/HD/HD_a2/Nas_Prog/entware/home/home-gallery/node_modules/exiftool-vendored.pl/bin/exiftool',
    exiftoolArgs: [ '-stay_open', 'True', '-@', '-' ],
    exiftoolEnv: {},
    checkPerl: true,
    pass: '{ready}',
    fail: '{ready}',
    exitCommand: '-stay_open\nFalse\n',
    versionCommand: '-ver\n-ignoreMinorErrors\n-execute\n',
    healthCheckCommand: '-ver\n-execute\n',
    backfillTimezones: true,
    defaultVideosToUTC: true,
    geoTz: [Function: geoTz],
    ignoreZeroZeroLatLon: true,
    imageHashType: false,
    includeImageDataMD5: undefined,
    inferTimezoneFromDatestamps: false,
    inferTimezoneFromDatestampTags: [
      'SubSecDateTimeOriginal',
      'SubSecCreateDate',
      'SubSecMediaCreateDate',
      'DateTimeOriginal',
      'CreateDate',
      'MediaCreateDate',
      'CreationDate',
      'DateTimeCreated',
      'TimeCreated'
    ],
    numericTags: [
      '*Duration*',
      'GPSAltitude',
      'GPSLatitude',
      'GPSLongitude',
      'GPSPosition',
      'Orientation'
    ],
    useMWG: false,
    ignoreShebang: true,
    processFactory: [Function: processFactory]
  },
  batchCluster: BatchCluster {
    emitter: EventEmitter {
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      [Symbol(kCapture)]: false
    },
    on: [Function: bound addListener],
    off: [Function: bound removeListener],
    options: {
      maxProcs: 1,
      maxProcAgeMillis: 300000,
      onIdleIntervalMillis: 2000,
      maxReasonableProcessFailuresPerMinute: 10,
      spawnTimeoutMillis: 30000,
      minDelayBetweenSpawnMillis: 1500,
      taskTimeoutMillis: 5000,
      maxTasksPerProcess: 500,
      endGracefulWaitTimeMillis: 500,
      streamFlushMillis: 30,
      cleanupChildProcs: true,
      maxIdleMsPerProcess: 0,
      maxFailedTasksPerProcess: 2,
      healthCheckIntervalMillis: 30000,
      pidCheckIntervalMillis: 120000,
      logger: [Function: logger],
      taskRetries: 1,
      exiftoolPath: '/mnt/HD/HD_a2/Nas_Prog/entware/home/home-gallery/node_modules/exiftool-vendored.pl/bin/exiftool',
      exiftoolArgs: [Array],
      exiftoolEnv: {},
      checkPerl: true,
      pass: '{ready}',
      fail: '{ready}',
      exitCommand: '-stay_open\nFalse\n',
      versionCommand: '-ver\n-ignoreMinorErrors\n-execute\n',
      healthCheckCommand: '-ver\n-execute\n',
      backfillTimezones: true,
      defaultVideosToUTC: true,
      geoTz: [Function: geoTz],
      ignoreZeroZeroLatLon: true,
      imageHashType: false,
      includeImageDataMD5: undefined,
      inferTimezoneFromDatestamps: false,
      inferTimezoneFromDatestampTags: [Array],
      numericTags: [Array],
      useMWG: false,
      ignoreShebang: true,
      processFactory: [Function: processFactory],
      observer: [EventEmitter],
      passRE: /(?:\n|^)\{ready\}(?:\r?\n|$)/,
      failRE: /(?:\n|^)\{ready\}(?:\r?\n|$)/
    }
  }
}
root@MyCloudEX2Ultra home-gallery #

We can observe that:

  • ignoreShebang is set to true
  • No version or error displayed

As a workaround, i have created a symlink from my actual perl path: /opt/bin/perl -> /usr/bin/perl.

root@MyCloudEX2Ultra home-gallery # ln -s /opt/bin/perl /usr/bin/perl
root@MyCloudEX2Ultra home-gallery # node -e 'ExifTool = require("exiftool-vendored").ExifTool;     exiftool = new ExifTool({ taskTimeoutMillis: 5000 });      console.log(exiftool);     exiftool.version().then(ve
r => {              console.log(`*****VERSION: ${ver}`);              exiftool.end();         }, rej => {              console.log(`*****REJECT: ${rej}`);          }).catch(err => console.log(`***** CATCH: ${err
}`));'
ExifTool {
  on: [Function (anonymous)],
  options: {
    maxProcs: 1,
    maxProcAgeMillis: 300000,
    onIdleIntervalMillis: 2000,
    maxReasonableProcessFailuresPerMinute: 10,
    spawnTimeoutMillis: 30000,
    minDelayBetweenSpawnMillis: 1500,
    taskTimeoutMillis: 5000,
    maxTasksPerProcess: 500,
    endGracefulWaitTimeMillis: 500,
    streamFlushMillis: 30,
    cleanupChildProcs: true,
    maxIdleMsPerProcess: 0,
    maxFailedTasksPerProcess: 2,
    healthCheckIntervalMillis: 30000,
    pidCheckIntervalMillis: 120000,
    logger: [Function: logger],
    taskRetries: 1,
    exiftoolPath: '/mnt/HD/HD_a2/Nas_Prog/entware/home/home-gallery/node_modules/exiftool-vendored.pl/bin/exiftool',
    exiftoolArgs: [ '-stay_open', 'True', '-@', '-' ],
    exiftoolEnv: {},
    checkPerl: true,
    pass: '{ready}',
    fail: '{ready}',
    exitCommand: '-stay_open\nFalse\n',
    versionCommand: '-ver\n-ignoreMinorErrors\n-execute\n',
    healthCheckCommand: '-ver\n-execute\n',
    backfillTimezones: true,
    defaultVideosToUTC: true,
    geoTz: [Function: geoTz],
    ignoreZeroZeroLatLon: true,
    imageHashType: false,
    includeImageDataMD5: undefined,
    inferTimezoneFromDatestamps: false,
    inferTimezoneFromDatestampTags: [
      'SubSecDateTimeOriginal',
      'SubSecCreateDate',
      'SubSecMediaCreateDate',
      'DateTimeOriginal',
      'CreateDate',
      'MediaCreateDate',
      'CreationDate',
      'DateTimeCreated',
      'TimeCreated'
    ],
    numericTags: [
      '*Duration*',
      'GPSAltitude',
      'GPSLatitude',
      'GPSLongitude',
      'GPSPosition',
      'Orientation'
    ],
    useMWG: false,
    ignoreShebang: false,
    processFactory: [Function: processFactory]
  },
  batchCluster: BatchCluster {
    emitter: EventEmitter {
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      [Symbol(kCapture)]: false
    },
    on: [Function: bound addListener],
    off: [Function: bound removeListener],
    options: {
      maxProcs: 1,
      maxProcAgeMillis: 300000,
      onIdleIntervalMillis: 2000,
      maxReasonableProcessFailuresPerMinute: 10,
      spawnTimeoutMillis: 30000,
      minDelayBetweenSpawnMillis: 1500,
      taskTimeoutMillis: 5000,
      maxTasksPerProcess: 500,
      endGracefulWaitTimeMillis: 500,
      streamFlushMillis: 30,
      cleanupChildProcs: true,
      maxIdleMsPerProcess: 0,
      maxFailedTasksPerProcess: 2,
      healthCheckIntervalMillis: 30000,
      pidCheckIntervalMillis: 120000,
      logger: [Function: logger],
      taskRetries: 1,
      exiftoolPath: '/mnt/HD/HD_a2/Nas_Prog/entware/home/home-gallery/node_modules/exiftool-vendored.pl/bin/exiftool',
      exiftoolArgs: [Array],
      exiftoolEnv: {},
      checkPerl: true,
      pass: '{ready}',
      fail: '{ready}',
      exitCommand: '-stay_open\nFalse\n',
      versionCommand: '-ver\n-ignoreMinorErrors\n-execute\n',
      healthCheckCommand: '-ver\n-execute\n',
      backfillTimezones: true,
      defaultVideosToUTC: true,
      geoTz: [Function: geoTz],
      ignoreZeroZeroLatLon: true,
      imageHashType: false,
      includeImageDataMD5: undefined,
      inferTimezoneFromDatestamps: false,
      inferTimezoneFromDatestampTags: [Array],
      numericTags: [Array],
      useMWG: false,
      ignoreShebang: false,
      processFactory: [Function: processFactory],
      observer: [EventEmitter],
      passRE: /(?:\n|^)\{ready\}(?:\r?\n|$)/,
      failRE: /(?:\n|^)\{ready\}(?:\r?\n|$)/
    }
  }
}
*****VERSION: 12.70
root@MyCloudEX2Ultra home-gallery #

Now ignoreSheband is false, and version is displayed.

I believe that exiftoolPath is being called directly, instead of calling perl with exiftoolPath.

Expected behavior
Shouldn't ignoreShebang = true be enough to avoid the inexistance of perl in /usr/bin?

Environment
WD My Cloud EX2 Ultra OS5 5.27.157 with Entware

Linux MyCloudEX2Ultra 4.14.22-armada-18.09.3 #1 SMP Thu Oct 27 08:25:39 UTC 2022 ga-18.09.3 Build-30 armv7l GNU/Linux

Installed entware packages perl and perlbase-cpan (for strict)

Perl v5.28.1
Node.js v18.17.1

Thank you!

@mceachen
Copy link
Member

Shouldn't ignoreShebang = true be enough to avoid the inexistance of perl in /usr/bin?

You also need to make sure /opt/bin is in your $PATH -- but I found that, depending on your setup, it still might not work properly. I've adjusted how we spawn exiftool in this next version, so at least you'll see a proper error message.

Thanks for taking the time to report this!

@mceachen
Copy link
Member

I just released v24.2.0 with this fix 🎉

@aztech55
Copy link
Author

@mceachen , Thank you very much for your quick work!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants