Package: vobcopy
Version: 1.2.0-6.0~fab1
Severity: normal
Tags: patch upstream

Dear Maintainer,

Item 1 concerns a regression specific to debian package because it is due to as
patch packaged by debian
The other ones are improvements.

1. Patch 0014-clang-Wall.patch introduced a regression.
   The seek_start variable isn't anymore divided by 2048
   Fix for this is in my patch

2. When specifying a directory that is the mountpoint of a iso mounted with
fuseiso, vobcopy isn't able to find the location of the iso and therefore is
unusable in that case (it thinks the name of the iso is fuseiso).
   Support for this (specific to fuseiso) is in my patch

3. Sometimes, the files of the ISO when mounted with fuseiso have a trailing
";?". Depending on the way fuseiso mounted the ISO (-c <charset>) option the
question mark '?' may be different, especially when mounted on with utf-8.
   I updated the source so that theses cases are better detected and managed

4. In the upstream version of vobcopy the -b <seek_start> and -e
<stop_before_end> options don't work when used in conjunction with -O
<vob_file_to_extract.vob>
   My use case is : extract part of a VOB file from the dvd, even if it is not
in the main title.
   Improvement for this is in my patch



-- System Information:
Debian Release: 9.0
  APT prefers stable
  APT policy: (991, 'stable'), (95, 'testing'), (90, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages vobcopy depends on:
ii  libc6        2.24-11+deb9u1
ii  libdvdread4  5.0.3-2

vobcopy recommends no packages.

vobcopy suggests no packages.

-- no debconf information
Description: <short summary of the patch>
 * Add support for DVD directories mounted from ISO image with fuseiso
 * Fix regression on seek_start
 * Support the -b and -e parameters also when using -O parameter
 * Fix issue when filesname on DVD are suffixed by ;? or similar 
Author: Fabien Steinmetz <[email protected]>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <other>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2017-07-06

Index: vobcopy-1.2.0/dvd.c
===================================================================
--- vobcopy-1.2.0.orig/dvd.c
+++ vobcopy-1.2.0/dvd.c
@@ -109,6 +109,7 @@ int get_device( char *path, char *device
 
 #if ( !defined( __sun ) )
   FILE *tmp_streamin;
+  FILE *tmp_streamin_fuseiso;
   char tmp_bufferin[ MAX_STRING ];
   char  tmp_path[ 256 ];
   int   l = 0;
@@ -117,6 +118,8 @@ int get_device( char *path, char *device
 
 #if (defined(__linux__))
   struct mntent* lmount_entry;
+  struct mntent* lmount_entry_fuseiso;
+
 #endif
 
 #if ( defined( __sun ) )
@@ -257,6 +260,30 @@ this is the code for the other-OSs, not
            }
        }
        endmntent(tmp_streamin);
+        
+        if (strcmp(lmount_entry->mnt_fsname, "fuseiso") == 0) {
+          fprintf ( stderr, "[Info] Fuseiso detected. I'm looking for the iso 
file\n");
+          // The directory is mounted by fuseiso. Here we try get the name & 
path of the ISO
+          char *homedir;
+          if ((homedir = getenv("HOME")) == NULL) {
+              // TODO
+              //homedir = getpwuid(getuid())->pw_dir;
+          }
+          
+          if ((tmp_streamin_fuseiso = 
setmntent(strcat(homedir,"/.mtab.fuseiso"), "r"))){
+            while ((lmount_entry_fuseiso = getmntent(tmp_streamin_fuseiso))){
+              if (strcmp(lmount_entry_fuseiso->mnt_dir, path) == 0){
+                /* Found the mount point */
+                fprintf ( stderr, "[Info] Device %s mounted on %s\n", 
lmount_entry_fuseiso->mnt_fsname, lmount_entry_fuseiso->mnt_dir);
+                strcpy(device, lmount_entry_fuseiso->mnt_fsname);
+                mounted = TRUE;
+                break; 
+              }
+            }
+            endmntent(tmp_streamin_fuseiso);
+          }
+        }
+
        if (mounted) 
             {
                /* device was set from /etc/mtab, no need to further check
Index: vobcopy-1.2.0/vobcopy.c
===================================================================
--- vobcopy-1.2.0.orig/vobcopy.c
+++ vobcopy-1.2.0/vobcopy.c
@@ -237,7 +237,7 @@ and potentially fatal."  - Thanks Leigh!
               break;
             }
           /*     sscanf( optarg, "%lli", &temp_var ); */
-          seek_start = temp_var;
+          seek_start = temp_var / 2048;
           cut_flag = TRUE;
           break;
 
@@ -989,7 +989,7 @@ and potentially fatal."  - Thanks Leigh!
               if( onefile_flag )
                 {
                   char *tokenpos, *tokenpos1;
-                  char tmp[12];
+                  char tmp[50];
                   tokenpos = onefile;
                   if( strstr( tokenpos, "," ) )
                     {
@@ -1026,10 +1026,16 @@ next: /*for the goto - ugly, I know... *
                 }
               else
                 {
-                  if( strstr( d_name, ";?" ) )
-                    {
-                      fprintf( stderr, _("\n[Hint] File on dvd ends in \";?\" 
(%s)\n"), d_name );
-                      strncat( output_file, d_name, strlen( d_name ) - 2 );
+                  if( strstr( d_name, ";" ) )
+                  {
+                      char * pch;
+                      int position_from_end;
+                      pch = strrchr(d_name, ';');
+                      position_from_end = strlen( d_name ) - (pch - d_name);
+                      if ( position_from_end < 4 ) {
+                        fprintf( stderr, _("\n[Hint] File on dvd ends in 
\";?\" (%s)\n"), d_name );
+                        strncat( output_file, d_name, strlen( d_name ) - 
position_from_end );
+                      }
                     }
                   else
                     {
@@ -1274,8 +1280,15 @@ next: /*for the goto - ugly, I know... *
 
                       for( a = 1; a < subvob; a++ )
                         {
-                          if( strstr( input_file, ";?" ) )
-                            input_file[ strlen( input_file ) - 7 ] = ( a + 48 
);
+                          if( strstr( input_file, ";" ) )
+                            {
+                              char * pch;
+                              int position_from_end;
+                              pch = strrchr( input_file, ';' );
+                              position_from_end = strlen( input_file ) - ( pch 
- input_file );
+                              if ( position_from_end < 4 )
+                                input_file[ strlen( input_file ) - 5 - 
position_from_end ] = ( a + 48 );
+                            } 
                           else
                             input_file[ strlen( input_file ) - 5 ] = ( a + 48 
);
 
@@ -1307,13 +1320,13 @@ next: /*for the goto - ugly, I know... *
                     fprintf( stderr, _("[Info] Start of %s at %d blocks \n"), 
output_file, start );
                   file_block_count = block_count;
                  starttime = time(NULL);
-                  for( i = start; ( i - start ) * DVD_VIDEO_LB_LEN < 
file_size; i += file_block_count)
+                  for( i = start + seek_start*2048/DVD_VIDEO_LB_LEN; ( i - 
start ) * DVD_VIDEO_LB_LEN < file_size - stop_before_end*2048 ; i += 
file_block_count)
                     {
                      int tries = 0, skipped_blocks = 0; 
                       /* Only read and write as many blocks as there are left 
in the file */
-                      if ( ( i - start + file_block_count ) * DVD_VIDEO_LB_LEN 
> file_size )
+                      if ( ( i - start + file_block_count ) * DVD_VIDEO_LB_LEN 
> file_size - stop_before_end*2048 )
                         {
-                          file_block_count = ( file_size / DVD_VIDEO_LB_LEN ) 
- ( i - start );
+                          file_block_count = ( (file_size - 
stop_before_end*2048 )/ DVD_VIDEO_LB_LEN ) - ( i - start );
                         }
 
                       /*                     DVDReadBlocks( dvd_file, i, 1, 
bufferin );this has to be wrong with the 1 there...*/

Reply via email to