#79 Correctly proccess files/pathes with brackets

closed-fixed
None
5
2012-03-28
2012-03-26
Zyxmon
No

Using glob in sql statements produces a bug in inotify when paths or files contain brackets. One needs to put brackets around the brackets. - i.e. substitute '[' with '[[]' and ']' with '[]]'.
I have made a quick patch (version 1.0.24) for inotify to process adding srt subtitles and renaming directories with brackets.

Discussion

  • Zyxmon
    Zyxmon
    2012-03-26

     
  • Justin Maggard
    Justin Maggard
    2012-03-27

    Replace glob with inequality pair

     
    Attachments
  • Justin Maggard
    Justin Maggard
    2012-03-27

    Can you try my patch instead? I believe it should even be faster than using glob.

     
  • Justin Maggard
    Justin Maggard
    2012-03-27

    • assigned_to: nobody --> jmaggard
     
  • Zyxmon
    Zyxmon
    2012-03-27

    Your patch is better and it WORKS.
    There is still an issue with adding srt file to the folder that contains brackets that was already indexed.
    I have tried a similar path in the function check_for_captions in the file metadata.c and got "Segmentation Fault" - the las line in the debug log is
    [code]
    inotify.c:721: debug: The file /volume1/public/Video/xxxx/yyyyy[1977]/zzzz.srt was moved here.
    My previous patch works in such cases. I'll try to find what is wrong with my new patch.

     
  • Justin Maggard
    Justin Maggard
    2012-03-28

    Add metadata.c fix

     
    Attachments
  • Justin Maggard
    Justin Maggard
    2012-03-28

    • status: open --> open-fixed
     
  • Justin Maggard
    Justin Maggard
    2012-03-28

    Great, thanks for checking! I added a new patch that includes a fix for metadata.c as well. Can you verify that it works also?

     
  • Zyxmon
    Zyxmon
    2012-03-28

    I have found a bug in my patch (missed second file argument). I'll try your patch or a similar path, I've made with the following sql statement:
    [code]
    id = sql_get_text_field(db, "SELECT ID from DETAILS where (PATH > '%q.' and PATH <= '%q.z'"
    " and MIME > 'video/' and MIME <= 'video/z') limit 1", file, file);
    [/code]
    There may be some difference with the speed.

     
  • Zyxmon
    Zyxmon
    2012-03-28

    I have checked the patch (a modified version of your patch) replace-glob3.patch and it solves the problem with srt files. I'm sure your patch will also work.
    I am attaching metadata.c patch that I've used.

     
  • Zyxmon
    Zyxmon
    2012-03-28

     
    Attachments
  • Justin Maggard
    Justin Maggard
    2012-03-28

    Sounds good. I'll go ahead and close this now.

     
  • Justin Maggard
    Justin Maggard
    2012-03-28

    • status: open-fixed --> closed-fixed