printing from Win95

Andrew Tridgell tridge at samba.anu.edu.au
Fri Sep 25 03:49:37 GMT 1998


> Ok - at this stage I've got it narrowed down to a change in either
> fileio.c or filename.c.  I'll have a more in depth look at the
> changes this afternoon.

the only fileio.c changed was a cleanup of the use of mmap(), which
doesn't affect printing and is only used if you compiled with
--with-mmap anyway. So it must be filename.c

In filename.c the diffs were:


    --- samba/source/smbd/filename.c        1998/09/10 00:35:09     1.13
    +++ /cvsroot/samba/source/smbd/filename.c       1998/09/19 03:34:12     1.14
    @@ -150,7 +150,8 @@
       /*
	* Don't cache trivial valid directory entries.
	*/
    -  if((strcmp(full_orig_name, ".") == 0) || (strcmp(full_orig_name, "..") == 0))
    +  if((*full_orig_name == '\0') || (strcmp(full_orig_name, ".") == 0) ||
    +     (strcmp(full_orig_name, "..") == 0))
	 return;

       /*
    @@ -245,7 +246,7 @@
       /*
	* Don't lookup trivial valid directory entries.
	*/
    -  if((strcmp(name, ".") == 0) || (strcmp(name, "..") == 0)) {
    +  if((*name == '\0') || (strcmp(name, ".") == 0) || (strcmp(name, "..") == 0)) {
	 global_stat_cache_misses++;
	 return False;
       }
    @@ -364,6 +365,17 @@
	*/

       trim_string(name,"/","/");
    +
    +  /*
    +   * If we trimmed down to a single '\0' character
    +   * then we should use the "." directory to avoid
    +   * searching the cache.
    +   */
    +
    +  if(!*name) {
    +    name[0] = '.';
    +    name[1] = '\0';
    +  }

       /*
	* Ensure saved_last_component is valid even if file exists.


These changes were made by Jeremy as part of his optimisation
efforts. I suspect that the printing stuff somehow relies on the old
behaviour of this code.
    
The changes are to three functions:
    
1) stat_cache_add()
1) stat_cache_lookup()
2) unix_convert()
    
The bug is almost certainly in the unix_convert() change. Can you
please confirm this by setting "stat cache = no" in smb.conf? That
will disable the other two functions.

If it is unix_convert() then please try removing these lines:

      if(!*name) {
        name[0] = '.';
        name[1] = '\0';
      }

and see if it fixes it. If it does then we just need to work out which
call to this is the problem ...
    


More information about the samba-technical mailing list