Skip to content
Snippets Groups Projects
  1. Nov 14, 2017
  2. Jul 31, 2017
  3. Mar 13, 2017
  4. Dec 07, 2015
  5. Sep 19, 2014
  6. Sep 18, 2014
    • Phillip Lougher's avatar
      mksquashfs: fix rare race in fragment waiting in filesystem finalisation · de032669
      Phillip Lougher authored
      
      Fix a rare race condition in fragment waiting when finalising the
      filesystem.  This is a race condition that was initially fixed in 2009,
      but inadvertantly re-introduced in the latest release when the code
      was rewritten.
      
      Background:
      
      When finalising the filesystem, the main control thread needs to ensure
      all the in-flight fragments have been queued to the writer thread before
      asking the writer thread to finish, and then writing the metadata.
      
      It does this by waiting on the fragments_outstanding counter.  Once this
      counter reaches 0, it synchronises with the writer thread, waiting until
      the writer thread reports no outstanding data to be written.
      
      However, the main thread can race with the fragment deflator thread(s)
      because the fragment deflator thread(s) decrement the fragments_outstanding
      counter and release the mutex before queueing the compressed fragment
      to the writer thread, i.e. the offending code is:
      
                              fragments_outstanding --;
                              pthread_mutex_unlock(&fragment_mutex);
                              queue_put(to_writer, write_buffer);
      
      In extremely rare circumstances, the main thread may see the
      fragments_outstanding counter is zero before the fragment
      deflator sends the fragment buffer to the writer thread, and synchronise
      with the writer thread, and finalise before the fragment has been written.
      
      The fix is to ensure the fragment is queued to the writer thread
      before releasing the mutex.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      de032669
  7. Sep 12, 2014
    • Phillip Lougher's avatar
      mksquashfs: fix progressbar for sort files · 27167b98
      Phillip Lougher authored
      
      The progressbar was incorrectly enabled *after* writing files
      if sort files were used.  This meant the progressbar would not
      be updated whilst files were being written to the filesystem.
      
      As this is the bulk of the work for Mksquashfs, this means
      the progressbar basically didn't appear to update whilst
      Mksquashfs was running, and then suddenly updated to 100%
      at the end of Mksquashfs.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      27167b98
  8. Sep 11, 2014
    • Phillip Lougher's avatar
      actions: add new noop action · d033a7f7
      Phillip Lougher authored
      
      This action does exactly what it says, i.e. nothing.
      
      It's designed to be used in conjunction with the verbose action
      options to enable debugging of the test expression.
      
      In otherwords, it allows you to check which files match on
      your test expression but without doing anything to the filesystem.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      d033a7f7
  9. Sep 10, 2014
  10. Sep 08, 2014
  11. Sep 06, 2014
    • Phillip Lougher's avatar
      actions: implement perm() test function · 80b55212
      Phillip Lougher authored
      
      Implement perm() test function, this is modelled directly on
      find -perm and implements its behaviour.
      
      Following find, three types of match are supported:
      
      perm(mode) - exact match
      perm(-mode) - all of the permission bits are set for the file
      perm(/mode) - any of the permission bits are set for the file
      
      With perm(/mode) if no permission bits are set in mode match
      on any file, this is to be consistent with find, which
      does this to be consistent with the behaviour of
      -perm -000
      
      Note, only symbolic modes are currently implemented.  Octal modes
      will be implemented next.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      80b55212
  12. Sep 05, 2014
    • Phillip Lougher's avatar
      action: fix move argument parsing · ab69e4fc
      Phillip Lougher authored
      
      At one point in time it was anticipated that the move action
      might take multiple arguments.  So it used the multi argument
      setting of "-2"...
      
      But the current implementation expects one argument only.  But
      the -2 setting allows zero arguments which isn't expected.  So
      enforce 1 argument.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      ab69e4fc
    • Phillip Lougher's avatar
      actions: update test function parser to handle variable amount of arguments · b193da1c
      Phillip Lougher authored
      
      Update the test function parser to handle variable amount of arguments,
      as that's now needed for the perm() test function.  Up till now, though
      updating the test parser has been a TODO, it been a low priority because
      it's done what's needed.
      
      Updating the parser to speculatively read the number of arguments
      present (and hence handle variable number of arguments) has been a
      TODO even without the need to handle a variable number of arguments
      because experience gained updating the action parser to do this showed
      it generates better syntax error messages.
      
      Previously the parser just parsed the number of arguments expected, and
      then quit.  The parser now parses all the arguments present, and then
      compares it against what was expected.
      
      No big deal?  Well guess what gives the better syntax error if you
      enter too many arguments.  Reading just the number of arguments
      expected, and then quitting, means the extra arguments cause to
      paraphrase a "I expected a ) here, and I got a comma or string".
      Now, you get an error message like "I got 5 arguments, but only
      expected 2".  Which IMHO is a better syntax error message.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      b193da1c
  13. Sep 04, 2014
  14. Sep 03, 2014
    • Phillip Lougher's avatar
      mksquashfs: fix cmdline arg free if >1 source dir and one of them is excluded · 4f24381e
      Phillip Lougher authored
      
      If you specify multiple sources (directories and/or files) on the command
      line, Mksquashfs will merge those sources into a root directory
      containing all of them.  This is different to the behaviour when
      a single directory is specified, in which case Mksquashfs creates
      a filesystem with the root containing the contents of the source
      directory.
      
      The difference manifests itself in the way the pathname of each
      of the directory entries is stored/obtained.  Normally to reduce
      runtime overhead when the directory entries have all come from the
      same parent directory, the source pathname is not stored in each
      directory entry, but is computed from the source pathname of the
      parent directory.  But in the case of the "dummy" root created
      to merge multiple sources specified on the command line, each
      directory entry does not share the same parent pathname, and so
      the source pathname of each directory entry is stored in the
      nonstandard_pathname field.  This nonstandard_pathname was originally
      filled in using a pointer to the source pathname on the command line.
      
      Now, if you later exclude one of these source directories, Mksquashfs
      will free the storage, and it will try and free the nonstandard_pathname
      field, which leads to a crash as you cannot free a command line argument.
      
      The fix to this is to strdup the command line source and store the
      copy in the directory entry.
      
      This is not considered a serious bug, it has not been reported, and
      the scenario was discovered by chance whilst looking at the code.
      Additionally the trigger scenario is highly artificial and there
      is no use-case where this bug will be triggered.  To trigger it you
      need to specifiy multiple source command arguments, and then you
      need to exclude one of them.  But, if you explicitly specified it
      on the command line why would you later exclude it, and if
      you did want to exclude it the obvious way would be to remove it
      from the command line.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      4f24381e
  15. Aug 31, 2014
    • Phillip Lougher's avatar
      actions: Regularise SYNTAX_ERROR() statements · 9d914641
      Phillip Lougher authored
      
      Get rid of the redundant "Action mode: " prefix and make the
      error messages match others.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      9d914641
    • Phillip Lougher's avatar
      actions: Regularise SYNTAX_ERROR() statements · 75e84b3d
      Phillip Lougher authored
      
      Get rid of the redundant "action: " prefix and make the
      error messages match others.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      75e84b3d
    • Phillip Lougher's avatar
      action: expression logging should be using action->args · 6b809631
      Phillip Lougher authored
      
      Fix display of the arguments in the action() statement.
      Previously it used action->action->args which is the arg
      count in the "generic" action statement, not the number of
      actual arguments in the particular parsed action - i.e. the instance
      rather than the definition.
      
      For actions which take a fixed number of arguments there, obviously,
      is no difference.  But for actions which take a variable number of
      arguments the generic action count is "-2", and it is the
      responsibility of an specific action parser helper to parse
      the arguments.  In this case the discovered number of arguments
      in the instance will be different to the -2 argument count in the
      generic statement.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      6b809631
    • Phillip Lougher's avatar
      action: add chmod() as a synonym for mode() · 26d29c11
      Phillip Lougher authored
      
      When testing the mode action, I'm always typing chmod() as
      that's what it's called elsewhere.  So add chmod as a synonym, it
      should probably have been called chmod in the first place.
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      26d29c11
    • Phillip Lougher's avatar
      actions: fix symbolic mode parsing in the mode() action · 051eafc8
      Phillip Lougher authored
      
      When I implemented symbolic modes in the mode() action (i.e.
      u+r-w) I made an oversight.  I didn't realise the specification
      allowed multiple =-+ sequences after the ownership specification.
      In otherwords if you wanted to add r (+r) and remove w (-w)
      from user, I assumed you would do u+r,u-w.  After revisiting
      the symbolic mode specification it turns out you should be able
      to do u+r-w as a short cut to the previous specification.  It
      also should be obvious I don't tend to use the symbolic mode but
      directly use the octal specification!
      
      So fix the parser to allow multiple =-+ sequences.
      
      So the syntax of the symbolic mode support goes from
      
      [ugoa]+[+-=]PERMS
      PERMS = [rwxXst]+ or [ugo]
      
      to
      
      [ugoa]*[[+-=]PERMS]+
      PERMS = [rwxXst]+ or [ugo]
      
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      051eafc8
  16. Aug 30, 2014
Loading