Bug 15074 - Audio::Scan module fails unit tests on Synology DS407, using SSODS and ELDK compile tools
: Audio::Scan module fails unit tests on Synology DS407, using SSODS and ELDK c...
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Scanner
: 7.4.1
: Other Linux (other)
: P1 normal (vote)
: 7.5.0
Assigned To: Andy Grundman
: Audio::Scan
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-11-08 10:26 UTC by graham_bardsley
Modified: 2010-04-08 17:26 UTC (History)
3 users (show)

See Also:
Category: ---


Attachments
Didn't realize I hadn't attached the file and was about to close the tab. (567 bytes, patch)
2009-11-08 12:24 UTC, graham_bardsley
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description graham_bardsley 2009-11-08 10:26:44 UTC
(Note patch file attached)

For years I've been maintaining a homebrewed system using SSODS as a base and with the ELDK compile environment from flipflip's site. 

I've noticed since upgrading to 7.4 there was a problem when running 'make test' with the Audio::Scan module - it fails miserably when running the asf tests. 

The buffer read code loads the GUIDs incorrectly - below is the start of the test cases, with a little extra logging code added:

t/08asf............Buffered 8192 bytes from file (min_wanted 30, max_wanted 8192)
Invalid ASF header: /src/SqueezeBinaryBulld/Audio-Scan-0.48/t/asf/wma92-32k.wma
  Expecting: 75b22630-668e-11cf-a6d9-00aa0062ce6c 
        Got: 75b22630-d588-668e-cf11-a6d900aa0062 
t/08asf............NOK 1                                                     
#   Failed test 'Audio offset ok'
#   at t/08asf.t line 22.
#          got: undef
#     expected: '5161'


The problem seems to be a mixture of usage of __attribute(packed). The GUID structure isn't declared as packed whereas the ASF_Object contains a packed version. I don't understand why it should make a difference as surely GUID structure is already laid out in a packed way and if I've tried printing the size of the bare structure and the variable in an ASF_Object and it comes out as the same. I'm sure there must be a compiler bug. 

Attached is a patch to get rid of the problem (very trivial)

Here's the output from gcc -

Reading specs from /usr/lib/gcc/arm-linux/4.0.0/specs
Target: arm-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libgcj --build=i386-redhat-linux-gnu --host=arm-linux --target=arm-linux --with-newlib --with-gnu-ld --with-gnu-as --enable-languages=c,c++ --enable-multilib=no --enable-nls=yes --disable-multilib
Thread model: posix
gcc version 4.0.0 (DENX ELDK 4.1 4.0.0-4)
Comment 1 graham_bardsley 2009-11-08 12:24:31 UTC
Created attachment 6285 [details]
Didn't realize I hadn't attached the file and was about to close the tab.
Comment 2 graham_bardsley 2009-11-08 12:37:46 UTC
Comment on attachment 6285 [details]
Didn't realize I hadn't attached the file and was about to close the tab.

diff -cr Audio-Scan-0.48-dist/include/common.h Audio-Scan-0.48/include/common.h
*** Audio-Scan-0.48-dist/include/common.h	Mon Nov  2 20:31:36 2009
--- Audio-Scan-0.48/include/common.h	Sun Nov  8 16:42:37 2009
***************
*** 36,42 ****
    uint16_t Data2;
    uint16_t Data3;
    uint8_t  Data4[8];
! } GUID;
  #endif
  
  /* for PRIu64 */
--- 36,42 ----
    uint16_t Data2;
    uint16_t Data3;
    uint8_t  Data4[8];
! } _PACKED GUID;
  #endif
  
  /* for PRIu64 */
***************
*** 69,72 ****
  extern int32_t skip_id3v2(PerlIO *infile);
  extern uint32_t _bitrate(uint32_t audio_size, uint32_t song_length_ms);
  extern off_t _file_size(PerlIO *infile);
! extern int _env_true(const char *name);
\ No newline at end of file
--- 69,72 ----
  extern int32_t skip_id3v2(PerlIO *infile);
  extern uint32_t _bitrate(uint32_t audio_size, uint32_t song_length_ms);
  extern off_t _file_size(PerlIO *infile);
! extern int _env_true(const char *name);
diff -cr Audio-Scan-0.48-dist/src/asf.c Audio-Scan-0.48/src/asf.c
*** Audio-Scan-0.48-dist/src/asf.c	Mon Nov  2 20:35:40 2009
--- Audio-Scan-0.48/src/asf.c	Sun Nov  8 16:29:56 2009
***************
*** 77,82 ****
--- 77,87 ----
    
    if ( !IsEqualGUID(&hdr.ID, &ASF_Header_Object) ) {
      PerlIO_printf(PerlIO_stderr(), "Invalid ASF header: %s\n", file);
+     PerlIO_printf(PerlIO_stderr(),"  Expecting: "); 
+         print_guid(ASF_Header_Object); 
+     PerlIO_printf(PerlIO_stderr(),"\n        Got: ");
+         print_guid(hdr.ID);
+     PerlIO_printf(PerlIO_stderr(),"\n");
      err = -1;
      goto out;
    }
Comment 3 Andy Grundman 2009-11-08 14:09:15 UTC
Thanks for working out what the problem was!
Comment 4 Andy Grundman 2009-11-09 05:51:23 UTC
*** Bug 14864 has been marked as a duplicate of this bug. ***
Comment 5 SVN Bot 2009-11-09 05:56:45 UTC
 == Auto-comment from SVN commit #517 to the opensource repo by andy ==
 == https://svn.slimdevices.com/opensource?view=revision&revision=517 ==

Fixed bug 15074, define GUID as _PACKED
Comment 6 Chris Owens 2010-04-08 17:26:47 UTC
This bug has been marked fixed in a released version of Squeezebox Server or the accompanying firmware or mysqueezebox.com release.

If you are still seeing this issue, please let us know!