You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kouhei Sutou <ko...@cozmixng.org> on 2005/10/02 07:22:26 UTC

uninitialized variable 'path' is used (Re: svn commit: r16388 - in trunk/subversion: include libsvn_fs libsvn_fs_fs)

Hi,

In <20...@morbius.ch.collab.net>
  "svn commit: r16388 - in trunk/subversion: include libsvn_fs libsvn_fs_fs" on Sat, 1 Oct 2005 12:13:05 -0500,
  maxb@tigris.org wrote:

> Author: maxb
> Date: Sat Oct  1 12:13:05 2005
> New Revision: 16388
> 
> Modified:
>    trunk/subversion/libsvn_fs/fs-loader.c

> Log:
> Fix numerous bugs in the svn_fs_*berkeley*() APIs.

> * subversion/libsvn_fs/fs-loader.c
>   (svn_fs_hotcopy): Read the fs-type file only once, and cause a fs-type
>     file to be added to the destination even if the source was a 1.0 repository
>     created before the inception of fs-type files.

> Modified: trunk/subversion/libsvn_fs/fs-loader.c
> Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_fs/fs-loader.c?rev=16388&p1=trunk/subversion/libsvn_fs/fs-loader.c&p2=trunk/subversion/libsvn_fs/fs-loader.c&r1=16387&r2=16388
> ==============================================================================
> --- trunk/subversion/libsvn_fs/fs-loader.c	(original)
> +++ trunk/subversion/libsvn_fs/fs-loader.c	Sat Oct  1 12:13:05 2005
> @@ -389,17 +389,12 @@
>  {
>    fs_library_vtable_t *vtable;
>    const char *path;
> -  svn_node_kind_t kind;
> +  const char *fs_type;
>  
> -  SVN_ERR (fs_library_vtable (&vtable, src_path, pool));
> +  SVN_ERR (svn_fs_type (&fs_type, path, pool));

'path' is uninitialized. Is this 'src_path'?

> +  SVN_ERR (get_library_vtable (&vtable, fs_type, pool));
>    SVN_ERR (vtable->hotcopy (src_path, dest_path, clean, pool));
> -
> -  /* Copy the fs-type file. */
> -  path = svn_path_join (src_path, FS_TYPE_FILENAME, pool);
> -  SVN_ERR (svn_io_check_path (path, &kind, pool));
> -  if (kind != svn_node_none)
> -    SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, FS_TYPE_FILENAME,
> -                                   pool));
> +  SVN_ERR (write_fs_type (path, fs_type, pool));

'src_path', not 'path'?

>  
>    return SVN_NO_ERROR;
>  }


Thanks,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: uninitialized variable 'path' is used (Re: svn commit: r16388 - in trunk/subversion: include libsvn_fs libsvn_fs_fs)

Posted by Max Bowsher <ma...@ukf.net>.
Kouhei Sutou wrote:
> Hi,
>
> In <20...@morbius.ch.collab.net>
>  "svn commit: r16388 - in trunk/subversion: include libsvn_fs 
> libsvn_fs_fs"
>  on Sat, 1 Oct 2005 12:13:05 -0500, maxb@tigris.org wrote:
>
>> Author: maxb
>> Date: Sat Oct  1 12:13:05 2005
>> New Revision: 16388
>>
>> Modified:
>>    trunk/subversion/libsvn_fs/fs-loader.c
>
>> Log:
>> Fix numerous bugs in the svn_fs_*berkeley*() APIs.
>
>> * subversion/libsvn_fs/fs-loader.c
>>   (svn_fs_hotcopy): Read the fs-type file only once, and cause a fs-type
>>     file to be added to the destination even if the source was a 1.0
>>     repository created before the inception of fs-type files.
>
>> Modified: trunk/subversion/libsvn_fs/fs-loader.c
>> Url:
>> http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_fs/fs-loader.c?rev=16388&p1=trunk/subversion/libsvn_fs/fs-loader.c&p2=trunk/subversion/libsvn_fs/fs-loader.c&r1=16387&r2=16388
>> ==============================================================================
>> --- trunk/subversion/libsvn_fs/fs-loader.c (original) +++
>> trunk/subversion/libsvn_fs/fs-loader.c Sat Oct  1 12:13:05 2005 
>> @@ -389,17
>>  +389,12 @@ {
>>    fs_library_vtable_t *vtable;
>>    const char *path;
>> -  svn_node_kind_t kind;
>> +  const char *fs_type;
>>
>> -  SVN_ERR (fs_library_vtable (&vtable, src_path, pool));
>> +  SVN_ERR (svn_fs_type (&fs_type, path, pool));
>
> 'path' is uninitialized. Is this 'src_path'?


Ooops!

Thank you very much for pointing this out.

Many apologies for committing such a stupid thing in the first place - it 
turns
out gcc's -Wuninitialized is disabled if optimization is not enabled!

/me adds -O2 to my permanent EXTRA_CFLAGS...


Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org