[netatalk-ja:0028] Re: Compile error in netatalk 3.0.2 making on debian 4 (etch)

HAT hat @ fa2.so-net.ne.jp
2013年 3月 13日 (水) 19:17:55 JST


HATです。

> netatalk 3.0.1, 3.0.2がリリースされていたのでHDL2-G2.0にインストールしま
> した。このNASはDebian 4 (etch)環境で稼働しています。
> 
> configure optionは以下のとおり。
> ./configure --with-init-style=debian --with-bdb=/usr/local/Berkeley-5.3.21
> 
> configure option等、インストール手順はこれまでと同様です。
> 
> 3.0.1は、無事インストール出来ました。
> 
> 3.0.2は、make中に以下のエラーが発生。
> 
>     make[3]: ディレクトリ
> `/mnt/sataraid1/root/work/netatalk-3.0.2/etc/afpd' に入ります
>     CC afpd-filedir.o
>     filedir.c: In function ‘moveandrename’:
>     filedir.c:266: warning: passing argument 1 of ‘of_findname’ from
> incompatible pointer type
>     filedir.c:266: error: too few arguments to function ‘of_findname’
>     make[3]: *** [afpd-filedir.o] エラー 1
>     make[3]: ディレクトリ
> `/mnt/sataraid1/root/work/netatalk-3.0.2/etc/afpd' から出ます

netatalk-3.0.2/etc/afpd/filedir.cの266行目周辺のソースはこれ。

263 #ifdef HAVE_ATFUNCS
264         opened = of_findnameat(sdir_fd, &path);
265 #else
266         opened = of_findname(&path);
267 #endif /* HAVE_ATFUNCS */

HAVE_ATFUNCSが定義されていないときだけ、266行目のof_findname()が
呼び出される。

次にHAVE_ATFUNCSが定義される条件を調べる。configure.acをみてみると...

ac_neta_haveatfuncs=yes
AC_CHECK_FUNCS(openat renameat fstatat unlinkat, , ac_neta_haveatfuncs=no)
if test x"$ac_neta_haveatfuncs" = x"yes" ; then
   AC_DEFINE([_ATFILE_SOURCE], 1, AT file source)
   AC_DEFINE([HAVE_ATFUNCS], 1, whether at funcs are available)
fi

openat() renameat() fstatat() unlinkat()といった関数の存在を調べて、
存在すればHAVE_ATFUNCを定義する。

> VMware Fusionで稼働しているdebian 4(etch)でも同様のエラー発生。
> VMware Fusionで稼働しているdebian 6(squeeze)では無事インストール完了。

取り敢えずFedora 18のmanでopenat()を調べてみる。

バージョン
    openat()   は  Linux  カーネル 2.6.16 で追加された。 ライブラリによるサ
    ポートは glibc バージョン 2.4 で追加された。

準拠
    POSIX.1-2008.  Solaris には、これと同じようなシステムコールが存在する。

FreeBSD 9のmanpageを見てみる。

HISTORY
    The open() function appeared in Version 6 AT&T UNIX.  The openat() func‐
    tion was introduced in FreeBSD 8.0.

つまり古い環境のときだけ266行目が呼び出される。

netatalk 3.0.1と3.0.2を比較すると、of_findname()関数の引数が1個から
2個に増えている。
具体的には、この変更。
Configurable symlink behaviour
https://github.com/franklahm/Netatalk/commit/acb180395693ed05a4e6a1edb6796c8e6f644a72

netatalk 3.0.2のof_findname()を検索してみると...

$ grep -r of_findname\( *
etc/afpd/catsearch.c:   if (!isdir && (of = of_findname(vol, path))) {
etc/afpd/desktop.c:    if (isadir || !(of = of_findname(vol, path))) {
etc/afpd/desktop.c:    if (isadir || !(of = of_findname(vol, path))) {
etc/afpd/desktop.c:    if (isadir || !(of = of_findname(vol, path))) {
etc/afpd/file.c:    if ((of = of_findname(vol, s_path))) {
etc/afpd/file.c:    if ((*of = of_findname(vol, path))) {
etc/afpd/filedir.c:        opened = of_findname(&path);
etc/afpd/filedir.c:        if (of_findname(vol, &path)) {
etc/afpd/filedir.c:    } else if (of_findname(vol, s_path)) {
etc/afpd/fork.c:    if ((opened = of_findname(vol, s_path))) {
etc/afpd/ofork.c:struct ofork *of_findname(const struct vol *vol, struct path *path)
etc/afpd/ofork.c:    if ((of = of_findname(vol, path))) {

filedir.cの266行目のof_findname()だけ引数が1個のまま。
単なる編集忘れでしょう。

こういうパッチを当てるとどうなりますか。
問題ないようであればcommitします。

--- filedir.c.orig      2013-01-22 02:28:44.000000000 +0900
+++ filedir.c   2013-03-13 19:12:00.822592205 +0900
@@ -263,7 +263,7 @@
 #ifdef HAVE_ATFUNCS
         opened = of_findnameat(sdir_fd, &path);
 #else
-        opened = of_findname(&path);
+        opened = of_findname(vol, &path);
 #endif /* HAVE_ATFUNCS */
 
         if (opened) {


-- 
HAT



Netatalk-ja メーリングリストの案内