Ticket #147 (closed bug: invalid)

Opened 10 months ago

Last modified 10 months ago

[REGRESSION] libisofs-0.6.18 fails test in rockridge.c

Reported by: loki_val Owned by: vreixo
Priority: medium Milestone:
Component: libisofs Version:
Keywords: Cc:

Description

libisofs-0.6.18 fails tests. 0.6.16 did not fail.

gdb test GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu"... (gdb) run Starting program: /var/tmp/portage/dev-libs/libisofs-0.6.18/work/libisofs-0.6.18/test/test [Thread debugging using libthread_db enabled]

CUnit - A Unit testing framework for C - Version 2.1-0 http://cunit.sourceforge.net/

Suite: Node Test Suite

Test: iso_node_new_root() ... passed Test: iso_node_new_dir() ... passed Test: iso_node_new_symlink() ... passed Test: iso_node_set_permissions() ... passed Test: iso_node_get_permissions() ... passed Test: iso_node_get_mode() ... passed Test: iso_node_set_uid() ... passed Test: iso_node_get_uid() ... passed Test: iso_node_set_gid() ... passed Test: iso_node_get_gid() ... passed Test: iso_dir_add_node() ... passed Test: iso_dir_get_node() ... passed Test: iso_dir_get_children() ... passed Test: iso_dir_iter_take() ... passed Test: iso_dir_iter_remove() ... passed Test: iso_node_take() ... passed Test: iso_node_take() during iteration ... passed Test: iso_node_set_name() ... passed Test: iso_node_add_xinfo() ... passed Test: iso_node_get_xinfo() ... passed Test: iso_node_remove_xinfo() ... passed

Suite: imageSuite

Test: iso_image_new() ... passed Test: iso_image_set_volume_id() ... passed Test: iso_image_get_volume_id() ... passed Test: iso_image_set_publisher_id() ... passed Test: iso_image_get_publisher_id() ... passed Test: iso_image_set_data_preparer_id() ... passed Test: iso_image_get_data_preparer_id() ... passed Test: iso_image_set_system_id() ... passed Test: iso_image_get_system_id() ... passed Test: iso_image_set_application_id() ... passed Test: iso_image_get_application_id() ... passed Test: iso_image_set_copyright_file_id() ... passed Test: iso_image_get_copyright_file_id() ... passed Test: iso_image_set_abstract_file_id() ... passed Test: iso_image_get_abstract_file_id() ... passed Test: iso_image_set_biblio_file_id() ... passed Test: iso_image_get_biblio_file_id() ... passed

Suite: Iso Tree Suite

Test: iso_tree_add_new_dir() ... passed Test: iso_tree_add_new_symlink() ... passed Test: iso_tree_add_new_special() ... passed Test: iso_tree_add_node() [1. dir] ... passed Test: iso_tree_add_node() [2. symlink] ... passed Test: iso_tree_path_to_node() ... passed

Suite: UtilSuite?

Test: strconv() ... [New Thread 0x7faa1f4946f0 (LWP 20843)]

passed

Test: int_pow() ... passed Test: DIV_UP() ... passed Test: ROUND_UP() ... passed Test: iso_bb() ... passed Test: iso_lsb/msb() ... passed Test: iso_read_lsb/msb() ... passed Test: iso_datetime_7() ... passed Test: iso_1_dirid() ... passed Test: iso_2_dirid() ... passed Test: iso_1_fileid() ... passed Test: iso_2_fileid() ... passed Test: iso_r_dirid() ... passed Test: iso_r_fileid() ... passed Test: iso_rbtree_insert() ... passed Test: iso_htable_put/get() ... passed

Suite: RockRidge? Suite

Test: rrip_calc_len(file) ...

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7faa1f4946f0 (LWP 20843)] iso_stream_get_input_stream (stream=0x0, flag=0) at libisofs/stream.c:675 675 IsoStreamIface?* class = stream->class; (gdb) bt full #0 iso_stream_get_input_stream (stream=0x0, flag=0) at libisofs/stream.c:675

class = <value optimized out>

#1 0x0000000000432ddd in add_zf_field (t=0x7fff274bcd80, n=<value optimized out>, info=0x0, sua_free=0x7fff274bccf8, ce_len=0x7fff274bced8, flag=1) at libisofs/rockridge.c:843

ret = <value optimized out> will_copy = 1 stream_type = 0 header_size_div4 = 0 block_size_log2 = 0 uncompressed_size = 0 input_stream = <value optimized out> last_stream = (IsoStream? *) 0x0 first_stream = (IsoStream? *) 0x0 first_filter = (IsoStream? *) 0x0 file = (IsoFile *) 0x1c30240 xipt = <value optimized out> zf = <value optimized out>

#2 0x000000000043316b in susp_calc_nm_sl_al (t=0x7fff274bcd80, n=0x1c302b0, space=208, su_size=0x7fff274bcd48, ce=0x7fff274bced8, flag=0) at libisofs/rockridge.c:1075

name = <value optimized out> namelen = 16 su_mem = 70 ce_mem = 0 xipt = <value optimized out> num_aapt = <value optimized out> sua_free = 117 ret = 0

#3 0x0000000000433560 in rrip_calc_len (t=0x7fff274bcd80, n=0x1c302b0, type=<value optimized out>, space=208, ce=0x7fff274bced8) at libisofs/rockridge.c:1177

su_size = 91 ret = <value optimized out>

#4 0x00000000004199f0 in test_rrip_calc_len_file () at test/test_rockridge.c:42

t = {image = 0x0, root = 0x0, iso_level = 0, rockridge = 0, joliet = 0, eltorito = 0, iso1999 = 0, aaip = 0, always_gmt = 0, omit_version_numbers = 0, allow_deep_paths = 0, allow_longer_paths = 0, max_37_char_filenames = 0,

no_force_dots = 0, allow_lowercase = 0, allow_full_ascii = 0, relaxed_vol_atts = 0, joliet_longer_paths = 0, rrip_version_1_10 = 0, aaip_susp_1_10 = 0, dir_rec_mtime = 0, replace_uid = 0, replace_gid = 0, replace_file_mode = 0, replace_dir_mode = 0, replace_timestamps = 0, uid = 0, gid = 0, file_mode = 0, dir_mode = 0, timestamp = 0, sort_files = 0, ino = 0, input_charset = 0x44259f "UTF-8", output_charset = 0x44259f "UTF-8", appendable = 0, ms_block = 0, now = 0, total_size = 0, vol_space_size = 0, bytes_written = 0, percent_written = 0, curblock = 0, ndirs = 0, path_table_size = 0, l_path_table_pos = 0, m_path_table_pos = 0, joliet_root = 0x0, joliet_ndirs = 0, joliet_path_table_size = 0, joliet_l_path_table_pos = 0, joliet_m_path_table_pos = 0, iso1999_root = 0x0, iso1999_ndirs = 0, iso1999_path_table_size = 0, iso1999_l_path_table_pos = 0, iso1999_m_path_table_pos = 0, catalog = 0x0, cat = 0x0, bootimg = 0x0, pad_blocks = 0, nwriters = 0, writers = 0x0, files = 0x0, buffer = 0x0, wthread = 0, th_attr = {size = '\0' <repeats 55 times>, align = 0}}

sua_len = <value optimized out> ce_len = 0

#5 0x00007faa1ee7e41a in run_single_test (pTest=0x1c2e640, pRunSummary=0x7faa1f086240) at TestRun?.c:818

nStartFailures = 0 pLastFailure = (volatile CU_pFailureRecord) 0x0 buf = {{jmpbuf = {29550144, 5700162869479734829, 0, 29550048, 0, 0, 5742506697479814701, 5700158767861202477}, mask_was_saved = 0, saved_mask = {val = {140368646224656, 140368639670760, 140368646224656, 140368639670808, 140368646224656, 4207632, 4294967295, 4207632, 2134272, 4207632, 140733852668224, 0, 0, 140368639668224, 140368644075593, 140368121167873}}}} PRETTY_FUNCTION = "run_single_test"

#6 0x00007faa1ee7eaad in run_single_suite (pSuite=0x1c2e5e0, pRunSummary=0x7faa1f086240) at TestRun?.c:759

pTest = (CU_pTest) 0x1c2e640 result = CUE_SUCCESS PRETTY_FUNCTION = "run_single_suite"

#7 0x00007faa1ee7ec6f in CU_run_all_tests () at TestRun?.c:379

pRegistry = <value optimized out> pSuite = (CU_pSuite) 0x1c2e5e0 result = CUE_SUCCESS result2 = CUE_SUCCESS

#8 0x0000000000403546 in main (argc=<value optimized out>, argv=<value optimized out>) at test/test.c:23 No locals.

Change History

Changed 10 months ago by scdbackup

  • owner changed from pygi to scdbackup
  • status changed from new to assigned

The failing function was added by me in release 0.6.18. In practice with xorriso it seems to make no trouble.

I was not aware that there is a test suit which one has to run. Now i will have to learn what it does and why it fails.

Changed 10 months ago by scdbackup

One thing is clear: this test does not use the API but puts its fingers deep into the private parts of libisofs.

The file test/test_rockridge.c mocks up a IsoFile object with ill entrails:

    file->stream = NULL; /* it is not needed here */

The API is not supposed to create IsoFile with no stream.

I will catch the SIGSEGV just in case that the API by some inner error produces a similarly crippled object (*it* *should* *not*). This will earn the test a ISO_NULL_POINTER error, nevertheless. The actual bug is in the test, not in the library.

This ticket will be handed over to Vreixo now, with the question whether it makes really sense to test objects which most probably cannot be produced by the API. Shouldn't a test rather use the API and - if ever - only break encapsulation to read inner states of libisofs ?

Changed 10 months ago by scdbackup

  • owner changed from scdbackup to vreixo
  • status changed from assigned to new

loki_val: From where did you get the advise to build and run test/test ?

I would like to do it myself. But i neither get a "test" program built by "make", nor does it compile successfully if i do "make test/test":

test/test.h:4:25: error: CUnit/Basic.h: No such file or directory

Google traces this back to http://cunit.sourceforge.net/ which is not among the dependencies of libisofs as defined in ./configure.ac .

Currently it seems that this code and its docs were not updated since libisofs was first released in early 2008. It appears rather like early scaffolding than like test code which should have been continued after the API was released.

Changed 10 months ago by loki_val

I got the advice from 'make check' which built test/test. If the tests are not meant to be run, I'll just disable them in our ebuild.

Changed 10 months ago by scdbackup

'make check'

Finally by your help i found it in Makefile.am. :)

Currently the tests are outdated. The time needed to repair the problematic code in test_rockridge.c would be better invested in re-arranging the test suit around the official libisofs API. Everybody seems busy with other things, though.

So it is best to disable test/test until its fate is decided.

libisofs is currently mainly tested by my various personal backups. Incremental ones which compare the ISO image with the disk content, and bulk ones of image sizes up to 20 GB. All done via xorriso and closey watched.

Many special use cases like El-Torito bootable images, or whether Joliet really works for MS-Windows, have been checked once and now wait for people who regularly need them.

Changed 10 months ago by vreixo

  • status changed from new to closed
  • resolution set to invalid

The tests were introduced by me when I began to work on next-generation libisofs. They have remained untouched for a long time, so it is possible than many of them are actually outdated. It is a pity, as I always wanted to have a complete unit test suite for libisofs, but unfortunately I have no enough time to work on it. So, as conclusion, don't trust test results.

Cheers Vreixo

Changed 10 months ago by scdbackup

So until a volunteer shows up i will deactivate the test section in Makefile.am

check_PROGRAMS = \
        test/test

test_test_CPPFLAGS = -Ilibisofs
test_test_LDADD = $(libisofs_libisofs_la_OBJECTS) \
        $(libisofs_libisofs_la_LIBADD) -lcunit
test_test_LDFLAGS = -L.. -lm

test_test_SOURCES = \
        test/test.h \
        test/test.c \
...
        test/mocked_fsrc.c
Note: See TracTickets for help on using tickets.