History log of /external/squashfs-tools/squashfs-tools/sort.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
85776df7ba8c5a0bb56ddccfff2bf6a0fc48cac8 31-Jan-2014 Phillip Lougher <phillip@squashfs.org.uk> Mksquashfs: add new -exit-on-error option

Mksquashfs recognises two kinds of error:

- Fatal errors which cause it to abort, and
- Non fatal errors which it considers can be safely ignored

These "non-fatal" errors are generally failure to read files or
directories, when this happens Mksquashfs skips or stores an empty
file and continues (flagging up what it has done to stderr).

From early feedback from users, this is generally considered a better
option than aborting. Often-times users are aware that there are files
which cannot be read by Mksquashfs, and want Mksquashfs to automatically
ignore them without having to explicitly exclude them on the command line
(for instance it may be known that there are files owned by other users).
Or for instance archiving a filesystem which is known to be partially
corrupted, and it is expected it will generate I/O errors on one or more
files (which are obviously unknown beforehand and cannot be explicitly
excluded). Additionally, often-times users do not know that there are
files which cannot be read, but would rather Mksquashfs flag these
errors and continue, rather than aborting what may be many hours of
compression.

But I have got feedback which shows in some use-cases this
behaviour is undesireable, and would rather Mksquashfs abort at
the failure to read any files.

So add a new option -exit-on-error which makes Mksquashfs abort on
these errors.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
9fdef3456e66721618127baabe073b6428b017e2 01-Mar-2013 Phillip Lougher <phillip@squashfs.org.uk> Update copyright

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
19b877db49fcda2f8b7e94a9ae482e98b445308d 23-Feb-2013 Phillip Lougher <phillip@squashfs.org.uk> sort: Generate_file_priorities() no longer needs to return error

Now that add_priority_list() does not return error there is no
need to return error status from generate_file_priorities().

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
17cade5cf6fa4fc716319d5a7ffd097795750ad5 23-Feb-2013 Phillip Lougher <phillip@squashfs.org.uk> sort: Add_priority_list() no longer needs to return error

The only possible failure in add_priority_list() was out of memory.
Now that this is handled by MEM_ERROR() we do not not need to return
any error status.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
0eb38ce48c8b9feacec59394170114f3601e181c 21-Feb-2013 Phillip Lougher <phillip@squashfs.org.uk> sort: Use MEM_ERROR() for out of space handling.

Replace hand crafted ERROR() messages with MEM_ERROR().

Note: out of memory will now immediately abort mksquashfs,
rather than the function returning error. This brings
it into line with other code in mksquashfs.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
83847c1beb852a7b3f5906a0f4c90be659e46794 23-Dec-2012 Phillip Lougher <phillip@squashfs.org.uk> mksquashfs/unsquashfs/pseudo/sort: Fix ERROR statement

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
6e77856a7922baa3a6f09ad3a69d55379fdca579 23-Dec-2012 Phillip Lougher <phillip@squashfs.org.uk> sort: Add MAX_LINE definition

rather than using bare constants.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
09b269ae68dcc1ce96b8d17cf8a09a2b0dfcbf2a 22-Dec-2012 Phillip Lougher <phillip@squashfs.org.uk> Fix some limits in the file parsing routines

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
9fed788fb90ed09d9b5d5b95128833df723dac9a 21-Dec-2012 Phillip Lougher <phillip@squashfs.org.uk> sort: Rewrite sort file processing

The previous version suffered from a number of nasty problems.

1. It couldn't handle filenames with spaces.

2. Short lines would cause the following line to be read, in the
unlikely event the following filename was a number this would
lead to incorrect parsing. Mostly such badly formed files would
lead to failures later on, but, such behaviour is incorrect and
should not be relied upon.

3. Lines with trailing junk after the priority would parse the junk
as further filename priority pairs, potentially leading to incorrect
parsing. Again, mostly such badly formed files would
lead to failures later on, but, such behaviour is incorrect and
should not be relied upon.

4. If a line exceeded the line limit (16384 bytes), the line would be
silently truncated.

5. If file reading failed for any other reason than EOF this was
not reported.

Fix these issues, and also add support for comment lines
(prefixed by #).

Files with spaces or starting with # can be escaped by \, i.e.

\#filename 1234
hello\ world 1234

Note the tightening up of parsing may cause badly formatted files
which previously worked to fail, this is regretted, but,
it is considered that the benefits of preventing badly formatted files
to cause unexpected behaviour in mksquashfs outweighs this.

This is mainly a consequence of two CVEs being raised against
squashfs-tools where they did not properly check user input,
leading to vulnerabilities. As a result of this, all user input
processing has been tightened up.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
8d7855406aa56cde395026bc26cb73792bf06f43 12-Dec-2012 Phillip Lougher <phillip@squashfs.org.uk> sort: tighten up sort file parsing

When reviewing read_sort_file() for buffer overflow, I noticed
it did not deal with the case where the sort file entry had
a missing priority.

Also deal with the unlikely case that fscanf() returns 0.

Plus make the existing case where the priority is outside the range
-32767:32768 a fatal error rather than skipping the entry, this
IMHO is a more appropriate response, and also improve the error
statement too.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
2c91e0e13abbbbcf25f48cee9acf1e99c0dd2cde 12-Dec-2012 Phillip Lougher <phillip@squashfs.org.uk> pseudo: avoid buffer overflow in read_sort_file() using fscanf()

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
01a3fdb680eda01279abec14fe97e86af7b29d15 30-Nov-2012 Phillip Lougher <phillip@squashfs.org.uk> sort: dynamically allocate filename in add_sort_list()

rather than allocating it on the stack.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
83d42a3fc898962aa1f1e8387f2ccb1114e0d294 01-Nov-2012 Phillip Lougher <phillip@squashfs.org.uk> Update email address

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
2477d0defc9d6dade582bb36596eed2e3cfddf8c 24-Oct-2012 Phillip Lougher <phillip@squashfs.org.uk> error.h: consolidate the various error macros into one header file

This eliminates the multiple separate implementations and brings
all the files into line with respect to synchronising with the
progress bar and exiting squashfs calling prep_exit_mksquashfs().

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
6d6fd8c6c238121e7e6299c99ba608488348ff12 19-Oct-2012 Phillip Lougher <phillip@squashfs.org.uk> mksquashfs/sort: Fix INFO() so that it is synchronised with the progress bar

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
8db6d288d01afc5464965b0bde8106cd7360c543 16-Oct-2012 Phillip Lougher <phillip@squashfs.org.uk> Update copyright dates

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
bf33836421997fde91f7a0c775de11f55c41cb01 22-Aug-2012 Phillip Lougher <phillip@squashfs.org.uk> mksquashfs: Use a linked list to store directory entries rather than an array

When scanning and storing the source directories use a
linked list to store the directory entries rather than an array.

This change is to more efficiently handle the empty action and the
soon to be implemented move action. The empty action removes
directory entries and the move action may move directory entries
from one directory to another. These actions are rather messy to
implement with arrays requiring any holes resulting from deleting/moving
to be filled by shuffling array entries down to fill the hole.
Linked lists allow entries to be deleted/moved much easier, which
is not only a performance improvement but results in more
aesthetically pleasing code.

Arrays were previously used only because the qsort function requires
arrays. The move to linked lists has improved the code and this is
an additional unexpected bonus, which is in addition to the previously
mentioned reasons to move to linked lists.

Qsort is stil used in this commit, and so code has been added to
convert the linked-list into an array before calling qsort, and code
has also been added to convert the sorted array into a linked-list.
This is messy, but only temporary, to ensure this commit doesn't
break mksquashfs. The next commit will remove qsort and will instead
add a merge sort which can efficiently sort linked lists
( O(n log n) which is the same complexity as qsort).

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
494479fd097eaab956dda035c45efadc151cadc0 03-Feb-2012 Phillip Lougher <phillip@squashfs.org.uk> mksquashfs: optimise dir_ent structure by removing pathname member

All dir_ent structures stored both the name and pathname
of each file scanned from the source directories. This was
rather wasteful of memory, as the majority of pathnames could
be computed from the parent directory's pathname and the
dir_ent's name.

Exceptions to this are names which have had a _1, _2 etc. appended due
to name clashes, pseudo files and cases where multiple directories
and files have been specified on the mksquashfs command line, in which
case the root directory will likely consist of entries each with a
different pathname. These cases have to be handled specially, either
with the new source_name member holding the original name, or in the
cases where there's a completely different pathname, by the use of the
nonstandard_pathname member.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/sort.c
f25a97dc4ba98debc223096be21d6624ae59063e 31-Dec-2010 plougher <plougher> get rid of global.h include
/external/squashfs-tools/squashfs-tools/sort.c
1ebb6e9932d448097d769f1366d8adaae797ea64 22-Jul-2010 plougher <plougher> Wrap some lines
/external/squashfs-tools/squashfs-tools/sort.c
3c786d833497ae71d867b753d367e0827dc36ca9 21-Jul-2010 plougher <plougher> Get rid of EXIT_MKSQUASHFS, that's not used any more.
/external/squashfs-tools/squashfs-tools/sort.c
e1c9a748a98e75900a47e9b6be56c4a8f29d0fd4 21-Jul-2010 plougher <plougher> Pass malloc failure in add_sort_list correctly up to calling function
in mksquashfs.c, rather than just ignoring it...

Plus remove BAD_ERROR use in sort.c and pass that abort error condition up
as well. BAD_ERROR in sort.c aborts without restoring the filesystem
if appending which isn't a good idea...
/external/squashfs-tools/squashfs-tools/sort.c
8d4404d1f63a558f4903eb8c939bd4306a805d0f 21-Jul-2010 plougher <plougher> Update copyright
/external/squashfs-tools/squashfs-tools/sort.c
1d1c6bbfeeb81076c10552b4eaa82ff0c3d8b406 21-Jul-2010 plougher <plougher> Pass malloc failure in add_priority_list up and deal wih it in dir_scan
/external/squashfs-tools/squashfs-tools/sort.c
f5456bd7c43f1da21d6206d0137a551f79627687 01-May-2010 plougher <plougher> Move some definitions from sort.h to mksquashfs.h
/external/squashfs-tools/squashfs-tools/sort.c
29e7f4723d0e57bc4378b65b7c2f55de2e4e6558 24-Feb-2010 plougher <plougher> Fix TRACE statement type warning and change printf format from %x to %d
/external/squashfs-tools/squashfs-tools/sort.c
a326c1872d1959d4a5342ed8210b430c6d8c1c07 29-Aug-2009 plougher <plougher> Clean-up appending code. Remove data from 'struct dir_ent' pointing
to the original root entries of the filesystem being appended to, and instead
use inode ('struct inode_info') to contain the data.
/external/squashfs-tools/squashfs-tools/sort.c
82ab2339a35bf5fb3ebc8bc7a6f316896ae5e5b1 21-Apr-2009 plougher <plougher> Fix -Wall warnings
/external/squashfs-tools/squashfs-tools/sort.c
048a8f8d948fd5b686149c63159adaa47d1cdbe2 31-Mar-2009 plougher <plougher> More code tidying
/external/squashfs-tools/squashfs-tools/sort.c
e69aac119c4660c567d5159729b9875c3330e4bb 30-Mar-2009 plougher <plougher> Code tidy
/external/squashfs-tools/squashfs-tools/sort.c
d9b631e9e82c9e0d0e14b7f3d0f2965c523b113d 08-Feb-2009 plougher <plougher> Update date on copyright message.
/external/squashfs-tools/squashfs-tools/sort.c
3d4f1ed074741dfe6eba531c32fb5d7ab585f6d9 08-Nov-2007 rlougher <rlougher> Add missing void return to function prototype of write_file.
/external/squashfs-tools/squashfs-tools/sort.c
f6cd337f8de328e2b448b9f29c00d9132748f7fe 19-Aug-2007 plougher <plougher> Update email address.
/external/squashfs-tools/squashfs-tools/sort.c
018d2b3b5bda64271196d46984d79c16f6268c46 23-Apr-2007 plougher <plougher> Make Mksquashfs deal better with files changing whilst filesystem is being read. Also
more work dealing with I/O errors.
/external/squashfs-tools/squashfs-tools/sort.c
29e3709bc814f5ebf166fb6ab4d6ea51ac98966b 15-Apr-2007 plougher <plougher> Update Mksquashfs to deal better with file read errors.
/external/squashfs-tools/squashfs-tools/sort.c
02bc3bcabf2b219f63961f07293b83629948f026 25-Feb-2007 plougher <plougher> updated mksquashfs to 3.2-r2
/external/squashfs-tools/squashfs-tools/sort.c
5507dd92370ba35d9f1671483beb0d4e47058293 06-Nov-2006 plougher <plougher> Update to par_mksquashfs version 3.1
/external/squashfs-tools/squashfs-tools/sort.c
9b5bf8c73c0eaf4f1ba0461615f4ed0d405a30cc 20-Mar-2006 plougher <plougher> Update CVS repository to the 3.0 release
/external/squashfs-tools/squashfs-tools/sort.c
04b0d5fb877f13636f801e954fb456d458b450ff 10-Feb-2006 plougher <plougher> A couple of improvements related to hardlink handling (mainly extra
print statements showing when hardlinked files are added to the fs).
/external/squashfs-tools/squashfs-tools/sort.c
117b2ea29a3a240bc6a063a73f8c11e786313a82 09-Feb-2006 plougher <plougher> Fixed sorting so that it now works with 3.0
/external/squashfs-tools/squashfs-tools/sort.c
8cb05cde913bb04297020629566540981a649273 12-Dec-2005 plougher <plougher> A couple of minor code changes, mainly to allow Mksquashfs to build on
Mac OS X without warnings.
/external/squashfs-tools/squashfs-tools/sort.c
c2759614989e149db2bad2e8845b4d9f9123cf89 23-Nov-2005 plougher <plougher> Updated email address and copyright dates.
/external/squashfs-tools/squashfs-tools/sort.c
1f413c84d736495fd61ff05ebe52c3a01a4d95c2 18-Nov-2005 plougher <plougher> Initial revision
/external/squashfs-tools/squashfs-tools/sort.c