[sane-devel] failing make sane-backends-1.0.18; sanei_scsi question]

Johannes Meixner jsmeix at suse.de
Mon Jan 22 15:34:10 CET 2007


Hello,

first of all: I didn't follow the whole thread because I thought
that a "failing make" is not of interest for me.

On Jan 19 21:00 Gerhard Jaeger wrote (shortened):
> On Friday 19 January 2007 15:31, Johannes Meixner wrote:
> > On Jan 19 15:00 Julien Michielsen wrote (shortened):
> > > sanei_scsi.c:1276: error: 'HZ' undeclared (first use in this function)
> >
> > This patch replaces the fixed HZ compile-time value (which is
> > no longer supported by new glibc) by the more correct
> > sysconf(_SC_CLK_TCK) runtime value because a fixed HZ compile-time
> > value may be wrong in the running system if the runtime system
> > is not exactly the same as the compile-time system:
> 
> That's what I've expected. So I think the patch I've sent
> earlier today should fix that issue.

I assume you mean the patch
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20070119/1f4a7757/sanei_scsi-HZ.bin
in this mail from you
http://lists.alioth.debian.org/pipermail/sane-devel/2007-January/018479.html
-----------------------------------------------------------------------------
--- sanei/sanei_scsi.c  22 Nov 2005 21:17:20 -0000      1.58
+++ sanei/sanei_scsi.c  19 Jan 2007 07:10:30 -0000
@@ -281,6 +281,20 @@ static char lastrcmd[16];  /* hold comman
 # define MAX_DATA      (32*1024)
 #endif
 
+#ifdef SG_SET_TIMEOUT
+# ifdef _SC_CLK_TCK
+#  define GNU_HZ  sysconf(_SC_CLK_TCK)
+# else
+#  ifdef HZ
+#   define GNU_HZ  HZ
+#  else
+#   ifdef CLOCKS_PER_SEC
+#    define GNU_HZ  CLOCKS_PER_SEC
+#   endif
+#  endif
+# endif
+#endif
+
 /* default timeout value: 120 seconds */
 static int sane_scsicmd_timeout = 120;
 int sanei_scsi_max_request_size = MAX_DATA;
@@ -1273,7 +1287,7 @@ sanei_scsi_open (const char *dev, int *f
      disconnect... ;-( */
   {
     int timeout;
-    timeout = sane_scsicmd_timeout * HZ;
+    timeout = sane_scsicmd_timeout * GNU_HZ;
     ioctl (fd, SG_SET_TIMEOUT, &timeout);
   }
 #endif
-----------------------------------------------------------------------------

sane-backends-1.0.18 builds with this patch for the released
openSUSE 10.2 and for openSUSE "factory" (i.e. the current
development version) but at the moment I didn't test older
Suse Linux versions.



Regarding resmgr:

See what I wrote here
http://lists.alioth.debian.org/pipermail/sane-devel/2007-January/018351.html
--------------------------------------------------------------------
- disable-resmgr-support.patch disables the resmgr support in SANE
  which is no longer needed in SANE because resmgr works now
  outside of SANE via ACLs for the scanner device nodes.
--------------------------------------------------------------------

And this is my disable-resmgr-support.patch
(some lines are wrapped here only by the mail software):
--------------------------------------------------------------------
--- configure.in.orig   2006-07-03 00:21:42.000000000 +0200
+++ configure.in        2006-09-11 10:47:29.000000000 +0200
@@ -131,15 +131,21 @@ AC_CHECK_HEADERS([io/cam/cam.h],,,[#incl
 
 SANE_CHECK_MISSING_HEADERS
 
-AC_CHECK_HEADER(resmgr.h,[
-       AC_CHECK_LIB(
-               resmgr,
-               rsm_open_device,[
-                       AC_DEFINE(HAVE_RESMGR,1,[define if you have
 the resmgr library])
-                       LIBS="$LIBS -lresmgr"
-               ]
-       )
-])
+# Since Suse Linux 10.0 resmgr installs ACLs on device nodes.
+# Therefore there is no need to patch applications with special resmgr
+# support anymore.
+# As the "rsm_open_device" calls in sanei_scsi.c and sanei_usb.c
+# are optionally via "ifdef HAVE_RESMGR" with fallback "open" calls,
+# the special resmgr support is not removed but only disabled here:
+#AC_CHECK_HEADER(resmgr.h,[
+#      AC_CHECK_LIB(
+#              resmgr,
+#              rsm_open_device,[
+#                      AC_DEFINE(HAVE_RESMGR,1,[define if you have
 the resmgr library])
+#                      LIBS="$LIBS -lresmgr"
+#              ]
+#      )
+#])
 
 AC_CHECK_HEADER(usbcalls.h,[
                        AC_DEFINE(HAVE_USBCALLS,1,[define if you have
 the usbcalls library])
--------------------------------------------------------------------

By the way:

Since there is no longer the need to have resmgr support compiled
into the software, I like to recommend resmgr as a well working
well seperated tool for certain kind of permission management.

When you do permission management via usual UNIX groups
(e.g. a group "scanner" for those users who should have
access to scanners), it is difficult (or impossible)
to set permissions depending on how a user is logged in 
(either directly at the system via console or graphical login
or from remote e.g. via ssh).

Usually you would like to grant access to local connected scanners
(like USB and SCSI scanners) if an only if a user is logged in
directly at the system (but not for remote users).

This kind of permission management is supported by resmgr.
This is why we use resmgr and not usual UNIX groups.


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH, Maxfeldstrasse 5      Mail: jsmeix at suse.de
90409 Nuernberg, Germany                    WWW: http://www.suse.de/



More information about the sane-devel mailing list