[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: xorriso: extracting files to stdout



Hi,

> I want to pass a fixed list of filenames to list.  The best way seems to
> be to use -wholename and hope that filenames do not contain special
> pattern characters:
> 
>   xorriso -indev image.iso -return_with WARNING 32 -report_about WARNING \
>     -find / -wholename "$name1" -o -wholename "$name2" -exec lsdl
> 
> Is there a way to avoid the interpretation of these patterns by xorriso
> or another way to list file with a fixed-string filename?

Currently not. (Again :))

Do i get it right that you want to get a non-zero exit value from
the program run if none of the files in the list exists in the ISO ?

Maybe you would be better off with a simple -ls command while
wildcard expansion is disabled by -iso_rr_pattern "off":

  $ xorriso -indev /some/non-ISO \
            -return_with WARNING 32 -report_about WARNING \
            -iso_rr_pattern off \
            -ls "/such*.c" --
  GNU xorriso 1.3.7 : RockRidge filesystem manipulator, libburnia project.

  xorriso : WARNING : Not found in ISO image: '/such*.c'

although a file /such.c does exist in the ISO image. It would be
listed without warning if -iso_rr_pattern was set to "on" or to "ls".


> The -return_with WARNING is there to fail if no file could be found
> (which is the case if image.iso is not a valid iso).

You already get a warning when loading a non-ISO-image.

  $ xorriso -indev /some/non-ISO \
            -return_with WARNING 32 -report_about WARNING
  GNU xorriso 1.3.7 : RockRidge filesystem manipulator, libburnia project.

  libisoburn: WARNING : No ISO 9660 image at LBA 0. Creating blank image.
  $ echo $?
  32

The commands -report_about and -return_with are already in effect
when the interpretation of -indev happens. That's because more than
one such setting might be desired. By this rule they do not have to
fight for being first command in the list.
(Normally commands get into effect only after all previous commands
 in the argument list have been executed.)

If you really want to tolerate a WARNING with -indev and later take
WARNING as cause for a non-zero exit value, then you first have to
set the event thresholds to a higher severity for the duration
of the -indev command:

  xorriso -return_with FAILURE 32 -report_about WARNING \
          -indev /some/non-ISO \
          -return_with WARNING 32 \
          -find ...


If you just want to know whether a data file is an ISO image
or not, you could also use the shell command "file"

  $ file test.iso
  test.iso: ISO 9660 CD-ROM filesystem data '...Volume.Id...'

  $ file not_an_iso
  not_an_iso: ASCII text

-------------------------------------------------------------------

> Maybe adding a -find_pattern option or making -iso_rr_pattern enable/disable
> the use of patterns by -find would be a good idea?

For compatibility reasons, it would inot be appropriate to extend
the effect of -iso_rr_pattern and -disk_pattern to -find tests.

But one could introduce pseudo tests -iso_rr_pattern and -disk_pattern
which always return true and control pattern interpretation. Like:

  -find / -iso_rr_pattern off ...more.tests.and.one.action...


> The system find has a similar issue, but there is a way to find fixed
> filenames by using the option -exec

In xorriso's -find, -exec is not a test and can only appear once.


> Would you consider adding a -fexec to your -find to use a system command
> to test a filename (and maybe more than the filename)?

That would be applicable to disk files, but not to files in the
ISO image.
It would be quite some effort to enable multiple -exec with arbitrary
xorriso commands and to attribute exit values to those commands.
This feature of POSIX "find" depends on the concept of a shell resp.
of POSIX program execution. xorriso would have to mimic this.


Have a nice day :)

Thomas


Reply to: