hns - 日記自動生成システム - Version 2.19.9

先月 2014年03月 来月
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Namazu for hns による簡易全文検索
詳しくは 詳細指定/ヘルプを参照して下さい
検索式:

2014年03月31日(月) 旧暦 [n年日記] [更新:"2014/04/01 23:29:16"]

#1 [NetBSD] installboot (or boot) does not recognize ffsv2

きょうはこんなのばかり:
installboot -fv /dev/rwd0a bootxx_ffsv2
....
----------------------
NetBSD MBR boot

NetBSD/x86 ffsv1 Primary Bootstrap
Boot failed (errno 2): Can't open /boot
----------------------

Software RAID
Primary boot に bootxx_ffsv2 と指定しても、上記の表示はいつも ffsv1
単なる間違いなのか、何か良くないことが起っているのか。 /dev/wd0a には
root
netbsd
RAID0-netbsd
が置いてあります。newfs -O 2 で format してあるはず。
man newfs より:
-O filesystem-format
            Select the filesystem-format
                  0    4.3BSD; This option is primarily used to build
                       root file systems that can be understood by older
                       boot ROMs.
                  1    FFSv1; normal fast-filesystem (default).
                  2    FFSv2; enhanced fast-filesystem (suited for more
                       than 1 Terabyte capacity, access control lists).
            To create an LFS filesystem see newfs_lfs(8).  To create a
            Linux Ext2 filesystem see newfs_ext2fs(8).
そうか、ffsv1 に代えて見よう。
なんと、それだった。無事起動。

まとめ HP MicroServer で Software RAID5:

HP MicroServer に、四台の disk を入れて、Software RAID server を作った
  • 消費電力は 60W 前後 (10W x 4 disk + 20W くらいの感じ)
  • NetBSD/amd64 6.1.3 を Network で起動
  • まず最初に disklabel -i wd0a と入力してから、手動で disklabel を書く
    6 partitions:
    #        size    offset     fstype [fsize bsize cpg/sgs]
     a:   2064321        63     4.2BSD      0     0     0  # (Cyl.      0*-   2047)
     c: 976773105        63     unused      0     0        # (Cyl.      0*- 969020)
     d: 976773168         0     unused      0     0        # (Cyl.      0 - 969020)
     e:  20643840   2064384       RAID                     # (Cyl.   2048 -  22527)
     f: 954064944  22708224       RAID                     # (Cyl.  22528 - 969020)
    
    a: は起動用、e: と f: がそれぞれ raid0, raid1 用(RAID の方式でなくて単に番号)。
  • それを次のようにして他の三台に写す
    disklabel wd0a > /tmp/R
    disklabel -R wd1a /tmp/R
    disklabel -R wd2a /tmp/R
    disklabel -R wd3a /tmp/R
    
  • TeraStation なども見ながら、
    次のような /etc/raid/raid0.conf を用意する。書くのはどこでも良いが、 a 区画を newfs して、それに書いておくのも一つの方法
    (# で始まる行や、空行はなくても良い)
    START array
    # numRow numCol numSpare
    1 4 0
    
    START disks
    /dev/wd0e
    /dev/wd1e
    /dev/wd2e
    /dev/wd3e
    
    #START spare
    #/dev/wd3e
    
    START layout
    # sectPerSU SUsPerParityUnit SUsPerReconUnit RAID_level_1
    128 1 1 5
    
    START queue
    fifo 100
    
  • raidctl を使って RAID5 を作る
    raidctl -C /etc/raid/raid0.conf raid0
    raidctl -I 2014033100           raid0
    raidctl -iv                     raid0
    raidctl -A yes			raid0
    
  • sysinst と入力して、NetBSD を raid0 に設置
  • kernel は (別の機械で) 次のような (RAID0A)を用意して
    include "arch/amd64/conf/GENERIC"
    
     # Kernel root file system and dump configuration.
    no config netbsd
    config         netbsd  root on raid0a type ?
    
    ./build.sh -j 2 -m amd64 tools
    ./build.sh -j 2 -m amd64 kernel=RAID0A
    
    で作る (-m amd64 は amd64 上なら必要ない)
  • 上記の /dev/wd0a に、上で作った kernel と、設置済の /boot を写す
    /boot 
    /netbsd
    
  • この日の日記の最初に書いた installboot を実行
    cd /usr/mdec
    installboot -fv /dev/rwd0a bootxx_ffsv1
    
  • 再起動して、
    • NetBSD の設定
    • 残っている RAID5 の設定 (方法は上記と同じだが、大きいので -iv のところで時間がかかる。 一時間半くらい)
    をする、必要な用途別 program は、例えば次のようにして追加する
  • を見て、次のように入力して、pkgin と sudo を追加
    env PKG_PATH=ftp://ftp.jp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/6.0_2013Q4/All \
    /usr/sbin/pkg_add pkgin;
    
    env PKG_PATH=ftp://ftp.jp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/6.0_2013Q4/All \
    /usr/sbin/pkg_add sudo
    
    この後は、次のようにして
    • /usr/pkg/etc/sudoers を変更
      # diff -u sudoers.orig sudoers
      --- sudoers.orig        2014-04-01 23:26:26.000000000 +0900
      +++ sudoers     2014-04-01 23:26:59.000000000 +0900
      @@ -72,7 +72,7 @@
       root ALL=(ALL) ALL
       
       ## Uncomment to allow members of group wheel to execute any command
      -# %wheel ALL=(ALL) ALL
      +%wheel ALL=(ALL) ALL
       
       ## Same thing without a password
       # %wheel ALL=(ALL) NOPASSWD: ALL
      # 
      
    • /etc/group の wheel に id を追加
    その後に次のような方法で pkgin で(何でも)追加
    sudo pkgin install zsh
    


  • 2014年03月27日(木) 旧暦 [n年日記] [更新:"2014/03/27 22:27:22"]

    #1 [wip][pkgsrc] open-vm-tools 9.4.0-1280544

    --- ../../sysutils/open-vm-tools/Makefile	2014-03-16 23:26:42.000000000 +0900
    +++ ./Makefile	2014-03-27 22:19:32.000000000 +0900
    @@ -1,8 +1,7 @@
     # $NetBSD: Makefile,v 1.44 2014/02/12 23:18:40 tron Exp $
     
    -DISTNAME=	open-vm-tools-2008.08.08-109361
    -PKGNAME=	open-vm-tools-2008.08.08.109361
    -PKGREVISION=	35
    +DISTNAME=	open-vm-tools-9.4.0-1280544
    +PKGNAME=	open-vm-tools-9.4.0-1280544
     CATEGORIES=	sysutils
     MASTER_SITES=	${MASTER_SITE_SOURCEFORGE:=open-vm-tools/}
     
    @@ -38,6 +37,8 @@
     .include "../../net/libdnet/buildlink3.mk"
     .include "../../security/openssl/buildlink3.mk"
     .include "../../textproc/icu/buildlink3.mk"
    +.include "../../x11/gtkmm/buildlink3.mk"
    +.include "../../graphics/gdk-pixbuf2-xlib/buildlink3.mk"
     
     .include "options.mk"
    
    /bin/sh ../../libtool --tag=CC --mode=compile gcc
      -DPACKAGE_NAME=\"open-vm-tools\"
      -DPACKAGE_TARNAME=\"open-vm-tools\"
      -DPACKAGE_VERSION=\"9.4.0\" -DPACKAGE_STRING=\"open-vm-tools\ 9.4.0\"
      -DPACKAGE_BUGREPORT=\"open-vm-tools-devel@lists.sourceforge.net\"
      -DPACKAGE_URL=\"\" -DPACKAGE=\"open-vm-tools\"
      -DVERSION=\"9.4.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
      -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
      -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
      -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1
      -DLT_OBJDIR=\".libs/\" -DHAVE_X11_SM_SMLIB_H=1
      -DHAVE_X11_ICE_ICELIB_H=1 -DHAVE_X11_EXTENSIONS_XCOMPOSITE_H=1
      -DHAVE_DLOPEN=1 -DNO_PROCPS=1 -DHAVE_INTTYPES_H=1
      -DHAVE_STDINT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_WCHAR_H=1
      -DHAVE_SYS_INTTYPES_H=1 -DHAVE_SYS_PARAM_H=1
      -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_USER_H=1 -DHAVE__BOOL=1
      -DHAVE_STDBOOL_H=1 -DHAVE_STRUCT_STAT_ST_RDEV=1
      -DTIME_WITH_SYS_TIME=1 -I.
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/open-vm-tools-9.4.0-1280544/lib/include
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/open-vm-tools-9.4.0-1280544/lib/include
      -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include
      -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include/libdrm
      -DUSING_AUTOCONF=1 -DOPEN_VM_TOOLS -I/usr/X11R7/include
      -D_REENTRANT -DU_HAVE_ELF_H=1 -DU_HAVE_ATOMIC=1
      -I/usr/pkg/include -DUSE_ICU -DHAVE_ICU_38 -DVMX86_TOOLS
      -D_REENTRANT -pthread -I/usr/pkg/include/gtk-2.0
      -I/usr/pkg/lib/gtk-2.0/include -I/usr/pkg/include/pango-1.0
      -I/usr/pkg/include/glib/gio-unix-2.0/ -I/usr/X11R7/include
      -I/usr/pkg/include/cairo -I/usr/pkg/include/atk-1.0
      -I/usr/pkg/include/cairo -I/usr/X11R7/include/pixman-1
      -I/usr/pkg/include/libpng16 -I/usr/X11R7/include
      -I/usr/pkg/include/gdk-pixbuf-2.0 -I/usr/pkg/include/libpng16
      -I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/harfbuzz
      -I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/glib/glib-2.0
      -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include
      -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include
      -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -DGTK2 -O2
      -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include
      -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include/libdrm
      -Wall -Werror -Wno-pointer-sign -Wno-unused-value
      -fno-strict-aliasing -Wno-unknown-pragmas -Wno-uninitialized
      -Wno-unused-but-set-variable -MT appUtilX11.lo -MD -MP -MF
      .deps/appUtilX11.Tpo -c -o appUtilX11.lo appUtilX11.c
    
    libtool: compile: gcc -DPACKAGE_NAME=\"open-vm-tools\"
      -DPACKAGE_TARNAME=\"open-vm-tools\"
      -DPACKAGE_VERSION=\"9.4.0\" "-DPACKAGE_STRING=\"open-vm-tools 9.4.0\""
      -DPACKAGE_BUGREPORT=\"open-vm-tools-devel@lists.sourceforge.net\"
      -DPACKAGE_URL=\"\" -DPACKAGE=\"open-vm-tools\"
      -DVERSION=\"9.4.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
      -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
      -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
      -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1
      -DLT_OBJDIR=\".libs/\" -DHAVE_X11_SM_SMLIB_H=1
      -DHAVE_X11_ICE_ICELIB_H=1 -DHAVE_X11_EXTENSIONS_XCOMPOSITE_H=1
      -DHAVE_DLOPEN=1 -DNO_PROCPS=1 -DHAVE_WCHAR_H=1
      -DHAVE_SYS_INTTYPES_H=1 -DHAVE_SYS_PARAM_H=1
      -DHAVE_SYS_USER_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1
      -DHAVE_STRUCT_STAT_ST_RDEV=1 -DTIME_WITH_SYS_TIME=1
      -I. -I/export/WRKOBJDIR/wip/open-vm-tools/work/open-vm-tools-9.4.0-1280544/lib/include
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.x11-buildlink/include
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.x11-buildlink/include/freetype2
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.x11-buildlink/include/libdrm
      -DUSING_AUTOCONF=1 -DOPEN_VM_TOOLS -D_REENTRANT
      -DU_HAVE_ELF_H=1 -DU_HAVE_ATOMIC=1 -DUSE_ICU -DHAVE_ICU_38
      -DVMX86_TOOLS -pthread
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/gtk-2.0
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/lib/gtk-2.0/include
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/pango-1.0
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/glib/gio-unix-2.0/
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/cairo
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/atk-1.0
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.x11-buildlink/include/pixman-1
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/libpng16
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/gdk-pixbuf-2.0
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/harfbuzz
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/include/glib/glib-2.0
      -I/export/WRKOBJDIR/wip/open-vm-tools/work/.buildlink/lib/glib-2.0/include
      -DGTK2 -O2 -Wall -Werror -Wno-pointer-sign -Wno-unused-value
      -fno-strict-aliasing -Wno-unknown-pragmas -Wno-uninitialized
      -Wno-unused-but-set-variable -MT appUtilX11.lo -MD -MP -MF
      .deps/appUtilX11.Tpo -c appUtilX11.c -fPIC -DPIC -o
      .libs/appUtilX11.o
    cc1: warnings being treated as errors
    In file included from appUtilX11.c:32:0:
    
    /export/WRKOBJDIR/wip/open-vm-tools/work/open-vm-tools-9.4.0-1280544/lib/include/posix.h:
      In function 'Posix_GetHostByName':
    /export/WRKOBJDIR/wip/open-vm-tools/work/open-vm-tools-9.4.0-1280544/lib/include/posix.h:207:4:
     error: implicit declaration of function 'gethostbyname_r'
    At top level:
    cc1: error: unrecognized command line option "-Wno-unused-but-set-variable"
    *** [appUtilX11.lo] Error code 1
    
    make: stopped in /export/WRKOBJDIR/wip/open-vm-tools/work/open-vm-tools-9.4.0-1280544/lib/appUtil
    1 error
    
    make: stopped in /export/WRKOBJDIR/wip/open-vm-tools/work/open-vm-tools-9.4.0-1280544/lib/appUtil
    *** [all-recursive] Error code 1
    


    2014年03月25日(火) 旧暦 [n年日記] [更新:"2014/03/28 23:25:24"]

    #1 [Hardware] HP Proliant Micro Server (4GB) AMD Turion(tm) II Neo N54L Dual 2.2GHz

    • 17,800 円、きのうポチッとして、今日届いた
    • 静かである
    • Disk が前挿しで、どうも DL320/G5 等と、無理矢理共用出来る気もする
      DL320/G5 の方が少し大きい。それで MicroServer に入っているものを抜いて DL320/G5 の方に使うことは出来るが、その逆は不可。
    • シリアルポート (直列通信口)がない .. かなりびっくり
    • 主記憶 (memory) は PC3-10600E DDR3 UB ECC (4GB)
    dmesg の一部
    NetBSD 6.1.3 (GENERIC)
    total memory = 3967 MB
    avail memory = 3837 MB
    timecounter: Timecounters tick every 10.000 msec
    RTC BIOS diagnostic error 0xa<fixed_disk>
    timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
    HP ProLiant MicroServer (   )
    mainbus0 (root)
    cpu0 at mainbus0 apid 0: AMD Turion(tm) II Neo N54L Dual-Core Processor, id 0x100f63
    cpu1 at mainbus0 apid 1: AMD Turion(tm) II Neo N54L Dual-Core Processor, id 0x100f63
    ioapic0 at mainbus0 apid 2: pa 0xfec00000, version 21, 24 pins
    acpi0 at mainbus0: Intel ACPICA 20110623
    acpi0: X/RSDT: OemId <HP    ,ProLiant,20131001>, AslId <HP  ,00000097>
    acpi0: SCI interrupting at int 9
    timecounter: Timecounter "ACPI-Fast" frequency 3579545 Hz quality 1000
    hpet0 at acpi0: high precision event timer (mem 0xfed00000-0xfed00400)
    

    ./build.sh -j 8 tools:

    ===> Tools built to /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64
    ===> build.sh ended:      Tue Mar 25 17:06:03 JST 2014
    ===> Summary of results:
             build.sh command:    ./build.sh -j 8 tools
             build.sh started:    Tue Mar 25 16:56:34 JST 2014
             NetBSD version:      6.1.3
             MACHINE:             amd64
             MACHINE_ARCH:        x86_64
             Build platform:      NetBSD 6.1.3 amd64
             HOST_SH:             /bin/sh
             No $TOOLDIR/bin/nbmake, needs building.
             Bootstrapping nbmake
             TOOLDIR path:        /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64
             DESTDIR path:        /export/src-netbsd-6.1.3-RELEASE/obj/destdir.amd64
             RELEASEDIR path:     /export/src-netbsd-6.1.3-RELEASE/obj/releasedir
             Created /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64/bin/nbmake
             Updated makewrapper:
              /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64/bin/nbmake-amd64
             Tools built to /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64
             build.sh ended:      Tue Mar 25 17:06:03 JST 2014
    ===> .
    781.03s 161.18s 9:28.74 165% 0+0k 147+2500io 2827pf+0w
    microserver@makoto 17:06:03/140325(/export/src-netbsd-6.1.3-RELEASE% 
    
    build.sh release して見ないと比較にはならないかな。

    ./build.sh -j 8 tools kernel=GENERIC:

    ===> Summary of results:
     build.sh command:    ./build.sh -j 8 
      -T /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64 kernel=GENERIC
     build.sh started:    Tue Mar 25 17:10:46 JST 2014
     NetBSD version:      6.1.3
     MACHINE:             amd64
     MACHINE_ARCH:        x86_64
     Build platform:      NetBSD 6.1.3 amd64
     HOST_SH:             /bin/sh
     TOOLDIR path:        /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64
     DESTDIR path:        /export/src-netbsd-6.1.3-RELEASE/obj/destdir.amd64
     RELEASEDIR path:     /export/src-netbsd-6.1.3-RELEASE/obj/releasedir
     Updated makewrapper: 
         /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64/bin/nbmake-amd64
     Building kernel without building new tools
     Building kernel:     GENERIC
     Build directory:     /export/src-netbsd-6.1.3-RELEASE/sys/arch/amd64/compile/obj/GENERIC
     Kernels built from GENERIC:
      /export/src-netbsd-6.1.3-RELEASE/sys/arch/amd64/compile/obj/GENERIC/netbsd
     build.sh ended:      Tue Mar 25 17:15:33 JST 2014
    ===> .
    490.02s 74.15s 4:47.39 196% 0+0k 2+435io 3900pf+0w
    

    ./build.sh -j 8 release:

    何か間違えたらしい
    ===> Successful make release
    ===> build.sh ended:      Tue Mar 25 19:13:03 JST 2014
    ===> Summary of results:
             build.sh command:    ./build.sh -j 8 release
             build.sh started:    Tue Mar 25 17:18:49 JST 2014
             NetBSD version:      6.1.3
             MACHINE:             amd64
             MACHINE_ARCH:        x86_64
             Build platform:      NetBSD 6.1.3 amd64
             HOST_SH:             /bin/sh
             TOOLDIR path:        /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64
             DESTDIR path:        /export/src-netbsd-6.1.3-RELEASE/obj/destdir.amd64
             RELEASEDIR path:     /export/src-netbsd-6.1.3-RELEASE/obj/releasedir
             Updated makewrapper: 
                  /export/src-netbsd-6.1.3-RELEASE/obj/tooldir.NetBSD-6.1.3-amd64/bin/nbmake-amd64
             Successful make release
             build.sh ended:      Tue Mar 25 19:13:03 JST 2014
    ===> .
    11108.01s 2096.34s 1:54:16.81 192% 0+0k 270+35298io 63495pf+0w
    0.88s 15.54s 1:54:16.81 0% 0+0k 0+1823io 0pf+0w
    
    いや、良く見たら 192% となっているので、これが実力かも知れない。
    microserver@makoto 20:18:25/140325(/export/src-netbsd-6.1.3-RELEASE)% sudo dkctl wd0a getcache
    /dev/rwd0a: read cache enabled
    /dev/rwd0a: write-back cache enabled
    /dev/rwd0a: read cache enable is not changeable
    /dev/rwd0a: write cache enable is changeable
    /dev/rwd0a: cache parameters are not savable
    

    ML115/G5 Athlon 4450B (dual core) でも試すと:

    CPU Athlon 4450B 2.3GHz Dual Core
    Memory 4GB
    
    (target arch も Release も少し違うので、 正確さには欠けるが) こちらの方が、大体二倍くらいの性能のようだ。
    make release started at:  Fri Mar 28 11:51:59 JST 2014
    make release finished at: Fri Mar 28 12:44:14 JST 2014
    ===> Successful make release
    ===> build.sh ended:   Fri Mar 28 12:44:14 JST 2014
    ===> Summary of results:
             build.sh command: ./build.sh -u -j 4 -m i386 release
             build.sh started: Fri Mar 28 11:51:58 JST 2014
             NetBSD version:   5.1
             MACHINE:          i386
             MACHINE_ARCH:     i386
             Build platform:   NetBSD 5.1 amd64
             HOST_SH:          /bin/sh
             TOOLDIR path:     /export/src-netbsd-5-1-RELEASE/obj/tooldir.NetBSD-5.1-amd64
             DESTDIR path:     /export/src-netbsd-5-1-RELEASE/obj/destdir.i386
             RELEASEDIR path:  /export/src-netbsd-5-1-RELEASE/obj/releasedir
             makewrapper:      /export/src-netbsd-5-1-RELEASE/obj/tooldir.NetBSD-5.1-amd64/bin/nbmake-i386
             Updated /export/src-netbsd-5-1-RELEASE/obj/tooldir.NetBSD-5.1-amd64/bin/nbmake-i386
             Successful make release
             build.sh ended:   Fri Mar 28 12:44:14 JST 2014
    ===> .
    4737.44s 917.92s 52:16.46 180% 0+0k 358+9761io 41635pf+0w
         0.32s 7.47s 52:16.46 0% 0+0k 1+859io 0pf+0w
    kuro@makoto 12:44:14/140328(/export/src-netbsd-5-1-RELEASE)% uname -a
    NetBSD kuro 5.1 NetBSD 5.1 (RAID0A) #0: Sun Oct 2 17:34:44 JST
    2011
    root@t-105.i.ki.nu:/export/cvs-work/src/sys/arch/amd64/compile/obj/RAID0A
    amd64
    


    2014年03月24日(月) 旧暦 [n年日記] [更新:"2014/03/27 08:33:59"]

    #1 [Cuda] Cuda 5.5

    warning C4819: ファイルは、現在のコード ページ (932) で表示できない文字を含んでいます。データの損失を防ぐために、ファイルを Unicode 形式で保存してください。
    nvcc -Xcompiler "/wd 4819"  hoge.cu
    
    とやれば、静かになる。


    2014年03月23日() 旧暦 [n年日記] [更新:"2014/03/23 20:51:30"]

    #1 [墓参] 墓参

    0640 出発
    0720 八街着
    0737 八街発
    0805 小堤着
    0815 小堤発
         (高田 IC 経由) 高速 400 円
    0900 平和公園着
    0924 平和公園(1)発
         平和公園(2)
         千葉寺
    
    Navigator の「一般道路・距離優先」に従ったら、 ちょっと面白い経路になった。
    高田 IC の付近で、無線のアンテナを発見。 (他にも二件)
    平和公園では、 ヤマガラ (デジタル図鑑) とおぼしき鳥を発見。


    2014年03月22日() 旧暦 [n年日記] [更新:"2014/07/17 14:37:27"]

    #1 [Windows] Adminstrator Password Recovery

    近所の方の Windows Vista (Dell 機)の Administrator password が分らなくなった ということで、解除して差上げた
    (ちなみに、以下は記憶で書いているので、勘違い(書違い)の可能性あり、後日見直予定)
    条件としては:
    • パスワード回復用の USB メモリは作っていない(利用不可)
    • Administrator の User ID は漢字(以下ではその名前を「漢字」と表現している)
    • OS 設置用の DVD はある

    ophcrach:

    総当り (brute force) で設定されたパスワードを見つけてくれるという ophcrack は、 何故か はうまく行かなかった。
    • 起動すると画面が乱数模様 (white noise のようなもの) になり、マウスに反応していることは分るが、操作は不能、text mode でも少し違う画面になるが、だめなことに変りがなかった
    • その状態で電源サイクル (OFF/ON) をすると、 起動に使った USB memory がこわれるらしく、起動しなくなる

    sethc.exe を使う:

    Forgot the administrator password? The Sticky Keys trick にある方法だが、USB メモリは使わなかった
    • OS 設置用の DVD で起動
    • 卓 (コマンド・プロンプト) の画面を出す
    • sethc.exe を別の場所に保存した上で cmd.exe を sethc.exe に写す
      copy c:\windows\system32\sethc.exe c:\
      copy c:\windows\system32\cmd.exe   c:\windows\system32\sethc.exe
      
      (上記の c:\ は Windows が設置されている区画の名前なので違うこともある)
    • 再起動して (ハードディスクから) 通常に起動させる
    • Login 画面が出るので、Shift キーを 5 回たたくと、(管理者権限の) 卓が開く
      net user を使うと、id の一覧が出る。 net user Administrator newpass などとすると、 パスワードを新たに設定出来る
      net user
      net user Administrator newpass
      
    • (もう一度) OS 設置用の DVD で起動
    • 卓 (コマンド・プロンプト) の画面を出す
    • 別の場所に保存してあった sethc.exe を元に戻す
      copy c:\sethc.exe c:\windows\system32\sethc.exe 
      
    • 通常に再起動
    こう書いてしまうと、とても簡単に見えるが、実際には、いろいろあったので、数時間かかった。
    この PC の場合には user id が (いつも使っている管理者権限の利用者名なのだけれど) 「漢字」だったので、一度は net user の次に何と入力して良いか分らなかった。
    この PC では、 通常の起動画面では 「hoge」「漢字」「Guest」の三つが出ている。この中の「漢字」が この PC の場合には (いつも使っている管理者権限の利用者名なのだけれど) Administrator の日本語表現だということに気が付くのに、とても時間がかかった。net user と入力した時に、この「hoge」「漢字」「Guest」の三つとは違う Administrator という字が出て来ていて、もしかしたら、これかな、 と思って、上に書いたように Administrator のパスワードを変更したら、それが「漢字」のパスワードになった。



    2014年03月21日(金) 旧暦 [n年日記] [更新:"2014/03/27 08:35:21"]

    #1 [pkgsrc] ham/fldigi on Ubuntu 13.10

      CC       addon-storage.o
    In file included from addon-storage.c:35:0:
    /usr/include/scsi/sg.h:38:3: error: unknown type name 'size_t'
       size_t iov_len;             /* Length in bytes  */
       ^
    make[5]: *** [addon-storage.o] Error 1
    make[5]: Leaving directory `/usr/pkgsrc/sysutils/hal/work/hal-0.5.14/hald/linux/addons'
    make[4]: *** [all-recursive] Error 1
    make[4]: Leaving directory `/usr/pkgsrc/sysutils/hal/work/hal-0.5.14/hald/linux'
    make[3]: *** [all-recursive] Error 1
    make[3]: Leaving directory `/usr/pkgsrc/sysutils/hal/work/hal-0.5.14/hald'
    make[2]: *** [all] Error 2
    make[2]: Leaving directory `/usr/pkgsrc/sysutils/hal/work/hal-0.5.14/hald'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/usr/pkgsrc/sysutils/hal/work/hal-0.5.14'
    make: *** [all] Error 2
    *** Error code 2
    
    Stop.
    bmake: stopped in /usr/pkgsrc/sysutils/hal
    *** Error code 1
    
    Stop.
    bmake: stopped in /usr/pkgsrc/sysutils/hal
    *** Error code 1
    
    Stop.
    bmake: stopped in /usr/pkgsrc/audio/pulseaudio
    *** Error code 1
    
    Stop.
    bmake: stopped in /usr/pkgsrc/ham/fldigi
    xen3-disk-e@makoto 09:02:53/140321(..ham/fldigi)% 
    
    By Joerg Schilling:

    in case on NetBSD:

    modena@makoto 10:04:59/140321(~)% cat -n  /usr/include/machine/ansi.h | sed -n 43,55p
        43  /*
        44   * Types which are fundamental to the implementation and may appear in
        45   * more than one standard header are defined here.  Standard headers
        46   * then use:
        47   *      #ifdef  _BSD_SIZE_T_
        48   *      typedef _BSD_SIZE_T_ size_t;
        49   *      #undef  _BSD_SIZE_T_
        50   *      #endif
        51   */
        52  #define _BSD_CLOCK_T_           unsigned int    /* clock() */
        53  #define _BSD_PTRDIFF_T_         long            /* ptr1 - ptr2 */
        54  #define _BSD_SIZE_T_            unsigned long   /* sizeof() */
        55  #define _BSD_SSIZE_T_           long            /* byte count or error */
    

    #2 [pkgsrc-bugs] PR pkg/48670

    pinapa@makoto 10:20:43/140321(..libgomp/.libs)% foreach i (*.o)
    echo $i; nm $i |egrep 'stack_chk|:'
    end
    affinity.o
    alloc.o
    bar.o
    barrier.o
    critical.o
    env.o
    error.o
    fortran.o
    iter.o
    iter_ull.o
    lock.o
    loop.o
    loop_ull.o
    mutex.o
    ordered.o
    parallel.o
    proc.o
    ptrlock.o
    sections.o
    sem.o
    single.o
    task.o
             U __stack_chk_fail_local
             U __stack_chk_guard
    team.o
             U __stack_chk_fail_local
             U __stack_chk_guard
    time.o
    work.o
    pinapa@makoto 10:20:53/140321(..libgomp/.libs)
    
    lang/gcc46/work/gcc-4.6.4/gcc/config/i386/i386.c
      32180 /* For 32-bit code we can save PIC register setup by using
      32181    __stack_chk_fail_local hidden function instead of calling
      32182    __stack_chk_fail directly.  64-bit code doesn't need to setup any PIC
      32183    register, so it is better to call __stack_chk_fail directly.  */
      32184
      32185 static tree
      32186 ix86_stack_protect_fail (void)
      32187 {
      32188   return TARGET_64BIT
      32189          ? default_external_stack_protect_fail ()
      32190          : default_hidden_stack_protect_fail ();
      32191 }
    
    gcc46-4.6.4-libiberty patch

    /bin/ksh: bad interpreter: No such file or directory (Linux/el6/trunk/x86_64):

    nios2-binutils-2.23/configure.log
    ===> Creating toolchain wrappers for nios2-binutils-2.23
    /bin/sh:
      /home/pbulk/build/cross/nios2-binutils/work/.wrapper/tmp/gen-transform:
      /bin/ksh: bad interpreter: No such file or directory
    *** Error code 126
    


    2014年03月19日(水) 旧暦 [n年日記] [更新:"2014/03/20 00:12:13"]

    #1 [pkgsrc] bootstrap on Ubuntu 12

    気を取直して、最初からやり直したら、bootstrap は簡単に終りました。
    rm -rf /usr/pkg /var/db/pkg /var/db/pkgdb
    (cd /usr/pkgsrc; cvs update -dPA)
    
    export SH=/bin/bash;
    mkdir /var/db;
    (cd  /usr/pkgsrc/bootstrap;
    ./bootstrap --prefix=/usr/pkg --pkgdbdir=/var/db/pkgdb)
    
    ただ、次のように言われます
    => Becoming ``root'' to make su-real-package-install (/bin/su)
    su: must be run from a terminal
    *** Error code 1
    
    Stop.
    bmake: stopped in /usr/pkgsrc/pkgtools/digest
    *** Error code 1
    
    root になって、sudo だけ作ろうとすると、libtool-base で:
    checking dependency style of g++... none
    checking how to run the C++ preprocessor... /lib/cpp
    configure: error: in `/usr/pkgsrc/devel/libtool-base/work/libtool-2.4.2':
    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
    See `config.log' for more details
    *** Error code 1
    
    Stop.
    bmake: stopped in /usr/pkgsrc/devel/libtool-base
    *** Error code 1
    
    Stop.
    bmake: stopped in /usr/pkgsrc/devel/libtool-base
    *** Error code 1
    
    Stop.
    bmake: stopped in /usr/pkgsrc/security/sudo
    root@ubuntu12-ja-emacs24:/usr/pkgsrc/security/sudo# 
    
    /lib/cpp でなくて /usr/bin/cpp のようです。
    /usr/pkg/etc/mk.conf に
    #CPPPATH=/usr/bin/cpp
    CXXCPP=/usr/bin/cpp
    
    と書いて見るかな ...実は単に c++ が入っていないだけでした。
    apt-get install g++
    
    これで解決

    (bootstrap) Ubuntu 13.10 (64 bit) でやり直し:

    Ubuntu 13.10 で bootstrap pkgsrc
     sudo apt-get install ssh
    
     mkdir .ssh
     vi ~/.ssh/authorized_keys
     sudo vi /etc/ssh/sshd_config 
    
     sudo apt-get install g++
     sudo apt-get install cvs
    
     cd /usr/
     sudo mkdir pkgsrc
     sudo chown makoto pkgsrc
     time cvs -Q -d :pserver:anoncvs@anoncvs.jp.netbsd.org:/cvs/cvsroot login
     (anoncvs)
     time cvs -Q -d :pserver:anoncvs@anoncvs.jp.netbsd.org:/cvs/cvsroot co pkgsrc
    
     sudo mkdir /var/db
     cd /usr/pkgsrc/bootstrap;
     time sudo env SH=/bin/bash LANG=C ./bootstrap --prefix=/usr/pkg --pkgdbdir=/var/db/pkgdb
    
    もし更に本当にやり直す時には、次のようにすっかり消してしまうの 「も」 良い
    /usr/pkgsrc/bootstrap/work/bin/bmake clean-depends;
    rm -rf /usr/pkgsrc/bootstrap/work;
    rm -rf /usr/pkg
    rm -rf /var/db/pkg*
    
    ...
    ===> bootstrap started: 2014	  3  19		   23:09:50 JST
    ===> bootstrap ended:   2014	  3  19		   23:21:29 JST
    316.27s 201.54s 11:39.11 74% 0+0k 84760+269656io 400pf+0w
    
    => Becoming ``root'' to make su-real-package-install (/bin/su)
    su: must be run from a terminal
    *** Error code 1
    
    sudo -s してから
    sudo だけ pkgsrc を入れる
    root@xen3-disk-e:/usr/pkgsrc/security/sudo# \
    env PATH=/usr/pkg/bin:/usr/pkg/sbin:${PATH} bmake package-install
    
    sudoers に次の行を加える
    --- /usr/pkg/etc/sudoers.orig  2014-03-20 00:04:54.101149316 +0900
    +++ /usr/pkg/etc/sudoers       2014-03-19 23:45:43.835610112 +0900
    @@ -73,6 +73,7 @@
     
     ## Uncomment to allow members of group wheel to execute any command
     # %wheel ALL=(ALL) ALL
    +%sudo ALL=(ALL) ALL
     
     ## Same thing without a password
     # %wheel ALL=(ALL) NOPASSWD: ALL
    
    /usr/pkg/etc/mk.conf に次のように書き加える
    .if exists(/usr/pkg/bin/sudo)
    SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
    .endif
    
    後は通常 user で:
    (cd /usr/pkgsrc/category/package;
    bmake package-install)
    
    しかし avr-binutils-2.23.2 は package 出来てしまった。 joyent/Linux では失敗しているのだけれど。
    xen3-disk-e@makoto 23:46:04/140319(..cross/avr-binutils)% uname -a
    Linux xen3-disk-e 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9
      16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    xen3-disk-e@makoto 23:46:12/140319(..cross/avr-binutils)% find . -name libiberty.a
    ./work/binutils-2.23.2/libiberty/libiberty.a
    ./work/.destdir/usr/pkg/avr/lib/libiberty.a
    xen3-disk-e@makoto 23:49:50/140319(..cross/avr-binutils)% 
    
    gcc 違いかな。
    xen3-disk-e@makoto 23:49:50/140319(..cross/avr-binutils)% gcc --version
    gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
    Copyright (C) 2013 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    xen3-disk-e@makoto 23:51:06/140319(..cross/avr-binutils)% ld --version 
    GNU ld (GNU Binutils for Ubuntu) 2.23.52.20130913
    Copyright 2013 Free Software Foundation, Inc.
    This program is free software; you may redistribute it under the terms of
    the GNU General Public License version 3 or (at your option) a later version.
    This program has absolutely no warranty.
    xen3-disk-e@makoto 23:51:11/140319(..cross/avr-binutils)% 
    


    2014年03月18日(火) 旧暦 [n年日記] [更新:"2014/03/19 13:41:24"]

    #1 [pkgsrc] bootstrap on Ubuntu 12

    makoto@ubuntu12-ja-emacs24:/usr/pkgsrc/bootstrap$ \
      time sudo ./bootstrap --prefix=/usr/pkg --pkgdbdir=/var/db/pkgdb
    ERROR: Your shell's echo command is not BSD-compatible.
    ERROR: Please select another shell by setting the environment
    ERROR: variable SH.
    
    real 0m0.197s
    user 0m0.008s
    sys 0m0.156s
    
    I needed 'sudo apt-get install zsh' to avoid echo problem.
    The right thing is
    export SH=/bin/bash
    
    and:
    => Full dependency bootstrap-mk-files-[0-9]*: found bootstrap-mk-files-20140314
     find_best:5: no such file or directory:
      /usr/pkgsrc/bootstrap/work/sbin/pkg_info -K /var/db/pkgdb
    ERROR: [resolve-dependencies] A package matching ``bootstrap-mk-files-[0-9]*'' should
    ERROR:     be installed, but one cannot be found.  Perhaps there is a
    ERROR:     stale work directory for ../../pkgtools/bootstrap-mk-files?
    *** Error code 1
    
    ubuntu12-ja-emacs24@root 02:17:28/140319(..pkgsrc/bootstrap)% grep -r find_best ../mk
    ../mk/pkgformat/pkg/resolve-dependencies:find_best() {
    ../mk/pkgformat/pkg/resolve-dependencies:  pkg=`find_best "$type" "$pattern"`
    
    ubuntu12-ja-emacs24@root 02:19:10/140319(..pkgsrc/bootstrap)% \ cat -n ../mk/pkgformat/pkg/resolve-dependencies | sed -n 32,39p
        32 find_best() {
        33  case $1 in
        34  bootstrap|tool)
        35   ${HOST_PKG_INFO} -E "$2" || ${TRUE};;
        36  build|full)
        37   ${PKG_INFO} -E "$2" || ${TRUE};;
        38  esac
        39 }
    
    The other trial (from the scratch, cleaned all, I believe)
    => Registering installation for bootstrap-mk-files-20140314
    ===> running: (cd /usr/pkgsrc/devel/bmake &&
      /usr/pkgsrc/bootstrap/work/bin/bmake USE_DESTDIR=no
      -DPKG_PRESERVE MAKECONF=/usr/pkgsrc/bootstrap/work/mk.conf
      install)
    ===> Installing dependencies for bmake-20140314
    => Full dependency bootstrap-mk-files-[0-9]*: found
     bootstrap-mk-files-20140314 find_best:5:
     no such file or directory:
      /usr/pkgsrc/bootstrap/work/sbin/pkg_info -K /var/db/pkgdb
    ERROR: [reduce-resolved-depends.awk] invalid dependency line
      full bootstrap-mk-files-[0-9]*
      /usr/pkgsrc/bootstrap/work/sbin/pkg_info -K /var/db/pkgdb
    *** Error code 1
    
    Stop.
    bmake: stopped in /usr/pkgsrc/devel/bmake
    ===> exited with status 1
    aborted.
    ubuntu12-ja-emacs24@root 08:30:51/140319(..pkgsrc/bootstrap)
    

    mk/pkgformat/pkg/depnes.mk -> reduce-resolved-depends.awk:

    ubuntu12-ja-emacs24@root 09:35:37/140319(..pkgsrc/bootstrap)% \
    cat -n ../mk/pkgformat/pkg/depends.mk | sed -n 45,51p
        45
        46 _REDUCE_RESOLVED_DEPENDS_CMD=${PKGSRC_SETENV} CAT=${CAT:Q}   \
        47     PKG_INFO=${PKG_INFO:Q}    \
        48     HOST_PKG_INFO=${HOST_PKG_INFO:Q}   \
        49    ${AWK} -f ${PKGSRCDIR}/mk/pkgformat/pkg/reduce-resolved-depends.awk \
        50     < ${_RDEPENDS_FILE}
        51
    
    実は何とか手で bootstrap して、何とか使い始めたのですが、
    => Returning to build of libtool-base-2.4.2nb6
    
    ERROR: [reduce-resolved-depends.awk] invalid dependency line
     bootstrap digest>=20010302 /usr/pkg/sbin/pkg_info -K /var/db/pkg
    *** Error code 1
    

    mk/pkgformat/pkg/reduce-resolved-depends.awk:

    どうも bootstrap と full が逆になっているのではないかという気も
    (そんなことがあるはずもないですが)
    root@ubuntu12-ja-emacs24:/usr/pkgsrc/security/sudo# \ cat -n ../../mk/pkgformat/pkg/reduce-resolved-depends.awk | sed -n 90,144p
        90
        91  for (i = 0; i < lines; ++i) {
        92   if (type[i] == "bootstrap" && checked_bootstrap[pkg[i]] != 1) {
        93    checked_bootstrap[pkg[i]] = 1
        94    found = 0
        95    if (PKG_INFO == HOST_PKG_INFO) {
        96     cmd = PKG_INFO " -qr " pkg[i]
        97     while (cmd | getline dpkg) {
        98       if (checked_full[dpkg] == 1)
        99        found = 1
       100     }
       101     close(cmd)
       102    }
       103    if (found == 0)
       104     print_line[i] = 1
       105   }
       106  }
       107
       108  for (i = 0; i < lines; ++i) {
       109   if (type[i] == "tool" && checked_tool[pkg[i]] != 1) {
       110    checked_tool[pkg[i]] = 1
       111    if (checked_bootstrap[pkg[i]] == 1)
       112     continue
       113    found = 0
       114    if (PKG_INFO == HOST_PKG_INFO) {
       115     cmd = PKG_INFO " -qr " pkg[i]
       116     while (cmd | getline dpkg) {
       117       if (checked_full[dpkg] == 1)
       118        found = 1
       119     }
       120     close(cmd)
       121    }
       122    if (found == 0)
       123     print_line[i] = 1
       124   }
       125  }
       126
       127  for (i = 0; i < lines; ++i) {
       128   if (type[i] == "build" && checked_build[pkg[i]] != 1) {
       129    checked_build[pkg[i]] = 1
       130    if (PKG_INFO == HOST_PKG_INFO)
       131     if (checked_bootstrap[pkg[i]] == 1)
       132       continue
       133    found = 0
       134    cmd = PKG_INFO " -qr " pkg[i]
       135    while (cmd | getline dpkg) {
       136     if (checked_full[dpkg] == 1)
       137       found = 1
       138    }
       139    close(cmd)
       140    if (found == 0)
       141     print_line[i] = 1
       142   }
       143  }
       144
    root@ubuntu12-ja-emacs24:/usr/pkgsrc/security/sudo# 
    
     53 BEGIN {
     54         CAT = ENVIRON["CAT"] ? ENVIRON["CAT"] : "cat"
     55         PKG_INFO = ENVIRON["PKG_INFO"] ? ENVIRON["PKG_INFO"] : "pkg_info"
     56         HOST_PKG_INFO = ENVIRON["HOST_PKG_INFO"] ? ENVIRON["HOST_PKG_INFO"] : "pkg_info"
     57 
     58         PROGNAME = "reduce-resolved-depends.awk"
     59         ERRCAT = CAT " 1>&2"
     60 
     61         while (getline == 1) {
     62                 if (NF != 3) {
     63                         print "ERROR: [" PROGNAME "] (1) invalid dependency line " $0 | ERRCAT
     64                         exit 1
     65                 }
     66                 if ($1 != "full" &&
     67                     $1 != "build" &&
     68                     $1 != "tool" &&
     69                     $1 != "bootstrap") {
     70                         print "ERROR: [" PROGNAME "] (2) invalid dependency line " $0 | ERRCAT
     71                         exit 1
     72                 }
     73                 type[NR] = $1
     74                 pattern[NR] = $2
     75                 pkg[NR] = $3
     76         }
     77         lines = NR + 1
     78 
    
    (同じ行があると、どちらか分らないが、この場合は (1) の方で出ている。(次の行の) Number of Field が違うと (?)
     bootstrap digest>=20010302 /usr/pkg/sbin/pkg_info -K /var/db/pkg
    
    確かに三つではない。
    root@ubuntu12-ja-emacs24:/usr/pkgsrc/devel/libtool-base# \
    head `/usr/pkg/bin/bmake show-var VARNAME=_RDEPENDS_FILE`
    bootstrap digest>=20010302     /usr/pkg/sbin/pkg_info -K /var/db/pkg
    digest-20121220
    tool nbpatch-[0-9]* /usr/pkg/sbin/pkg_info -K /var/db/pkg
    nbpatch-20100124
    
    この上の行から来ているらしい。ここに限って言えば -K /var/db/pkg は不要の気がする。
    もしかして /var/db/pkg と /var/db/pkgdb を僕が混用しているのかな


    2014年03月17日(月) 旧暦 [n年日記] [更新:"2014/03/17 19:17:15"]

    #1 [Perl] Pass Hash pointer (reference) to subroutine

    きょうはこれだけのことがなかなか出来なかった。
    #!/usr/pkg/bin/perl
    use strict;
    # Pass Hash pointer (reference) to subroutine
    
    sub print_hash($){
        my ($hashref) = shift;
        foreach my $k (keys $hashref) {
            print $k .' -> '. $hashref ->{$k},"\n";
        }
    }
    
    my (%HASH) = qw(a aa b bb);
    print_hash(\%HASH);
    exit;
    __END__
    


    2014年03月08日() 旧暦 [n年日記] [更新:"2014/03/08 18:08:05"]

    #1 [Emacs] emacs-24.3.50nb20130307 is quite stable (but)

    This is the first Segmentation of today (17:45)
    (gdb) bt
    #0  balance_intervals_internal (tree=0x72656e006c696e61) at intervals.c:493
    #1  0x0000000000580dc4 in balance_intervals_internal (tree=0xa97e580) at intervals.c:494
    #2  0x0000000000526555 in sweep_strings () at alloc.c:1844
    #3  gc_sweep () at alloc.c:6347
    #4  Fgarbage_collect () at alloc.c:5586
    #5  0x000000000053b5bd in maybe_gc () at lisp.h:4519
    #6  eval_sub (form=31458470) at eval.c:2084
    #7  0x000000000053bcb6 in Fprogn (body=<optimized out>) at eval.c:468
    #8  0x000000000053b234 in unbind_to (count=<optimized out>, value=12034098) at eval.c:3309
    #9 0x000000000056de20 in exec_byte_code
     (bytestr=9223372036854775807, vector=30, maxdepth=159066312,
     args_template=0, nargs=7, args=0x82b4e0) at bytecode.c:941
    #10 0x000000000053bea4 in funcall_lambda (fun=30035797,
     nargs=<optimized out>, arg_vector=0x7f7fffffb180) at
     eval.c:3049
    #11 0x000000000053c217 in Ffuncall (nargs=<optimized out>, args=0x7f7fffffb178) at eval.c:2876
    #12 0x000000000056ddd3 in exec_byte_code
     (bytestr=9223372036854775807, vector=30, maxdepth=159066312,
     args_template=12034098, nargs=2, args=0x82b4e0) at
     bytecode.c:919
    #13 0x000000000053bea4 in funcall_lambda (fun=30035501,
     nargs=<optimized out>, arg_vector=0x7f7fffffb340) at
     eval.c:3049
    #14 0x000000000053c217 in Ffuncall (nargs=<optimized out>, args=0x7f7fffffb338) at eval.c:2876
    #15 0x000000000056ddd3 in exec_byte_code
     (bytestr=9223372036854775807, vector=30, maxdepth=159066312,
     args_template=0, nargs=2, args=0x82b4e0) at bytecode.c:919
    #16 0x000000000053bea4 in funcall_lambda (fun=29749893,
     nargs=<optimized out>, arg_vector=0x7f7fffffb520) at
     eval.c:3049
    #17 0x000000000053c217 in Ffuncall (nargs=<optimized out>, args=0x7f7fffffb518) at eval.c:2876
    #18 0x000000000056ddd3 in exec_byte_code
     (bytestr=9223372036854775807, vector=30, maxdepth=159066312,
     args_template=0, nargs=1, args=0x82b4e0) at bytecode.c:919
    #19 0x000000000053bea4 in funcall_lambda (fun=31540421,
     nargs=<optimized out>, arg_vector=0x7f7fffffb6d0) at
     eval.c:3049
    #20 0x000000000053c217 in Ffuncall (nargs=<optimized out>, args=0x7f7fffffb6c8) at eval.c:2876
    #21 0x000000000056ddd3 in exec_byte_code
     (bytestr=9223372036854775807, vector=30, maxdepth=159066312,
     args_template=0, nargs=1, args=0x82b4e0) at bytecode.c:919
    #22 0x000000000053bea4 in funcall_lambda (fun=31541221,
     nargs=<optimized out>, arg_vector=0x7f7fffffb8f8) at
     eval.c:3049
    #23 0x000000000053c217 in Ffuncall (nargs=<optimized out>, args=0x7f7fffffb8f0) at eval.c:2876
    #24 0x0000000000539610 in Fcall_interactively
     (function=28126146, record_flag=12034098, keys=12068477) at
     callint.c:836
    #25 0x000000000053c46a in Ffuncall (nargs=<optimized out>, args=0x7f7fffffbab8) at eval.c:2822
    #26 0x000000000056ddd3 in exec_byte_code
     (bytestr=9223372036854775807, vector=30, maxdepth=159066312,
     args_template=0, nargs=4, args=0x82b4e0) at bytecode.c:919
    #27 0x000000000053c217 in Ffuncall (nargs=<optimized out>, args=0x7f7fffffbc20) at eval.c:2876
    #28 0x000000000053c616 in call1 (fn=<optimized out>, arg1=<optimized out>) at eval.c:2614
    #29 0x00000000004dff0a in command_loop_1 () at keyboard.c:1556
    #30 0x000000000053aaff in internal_condition_case
     (bfun=0x4dfbb1 <command_loop_1>, handlers=<optimized out>,
     hfun=0x4d7679 <cmd_error>) at eval.c:1354
    #31 0x00000000004d648a in command_loop_2 (ignore=<optimized out>) at keyboard.c:1174
    #32 0x000000000053aa13 in internal_catch (tag=Cannot access memory at address 0x72656e006c696e29
    ) at eval.c:1118
    #33 0x00000000004d7272 in command_loop () at keyboard.c:1145
    #34 recursive_edit_1 () at keyboard.c:777
    #35 0x00000000004d757f in Frecursive_edit () at keyboard.c:845
    #36 0x000000000053c401 in Ffuncall (nargs=<optimized out>, args=0x7f7fffffbfc0) at eval.c:2812
    #37 0x000000000056ddd3 in exec_byte_code
     (bytestr=9223372036854775807, vector=30, maxdepth=159066312,
     args_template=256, nargs=1, args=0x82b4e0) at bytecode.c:919
    #38 0x000000000053c217 in Ffuncall (nargs=<optimized out>, args=0x7f7fffffc150) at eval.c:2876
    #39 0x000000000053d162 in Fapply (nargs=<optimized out>, args=0x7f7fffffc200) at eval.c:2354
    #40 0x000000000053c6cd in apply1 (fn=12170722, arg=<optimized out>) at eval.c:2588
    #41 0x000000000053c864 in call_debugger (arg=93438006) at eval.c:332
    #42 0x000000000053cc47 in maybe_call_debugger (data=93438054,
     sig=12088114, conditions=8579998) at eval.c:1733
    #43 Fsignal (error_symbol=12088114, data=93438054) at eval.c:1551
    ...
    ..
    ---Type <return> to continue, or q <return> to quit---
    #88 0x00000000004d648a in command_loop_2 (ignore=<optimized out>) at keyboard.c:1174
    #89 0x000000000053aa13 in internal_catch (tag=Cannot access memory at address 0x72656e006c696e29
    ) at eval.c:1118
    #90 0x00000000004d72f3 in command_loop () at keyboard.c:1153
    #91 recursive_edit_1 () at keyboard.c:777
    #92 0x00000000004d757f in Frecursive_edit () at keyboard.c:845
    #93 0x00000000004d2392 in main (argc=<optimized out>, argv=0x7f7fffffdab8) at emacs.c:1646
    
    Lisp Backtrace:
    
    "Automatic GC" (0xb53208)
    "wl-thread-save-entities" (0xffffb180)
    "wl-thread-save-entity" (0xffffb340)
    "wl-summary-save-view-cache" (0xffffb520)
    "wl-summary-save-view" (0xffffb6d0)
    "wl-summary-exit" (0xffffb8f8)
    "call-interactively" (0xffffbac0)
    "command-execute" (0xffffbc28)
    "recursive-edit" (0xffffbfc8)
    "debug" (0xffffc158)
    "isearch-search" (0xffffc4b0)
    "isearch-search-and-update" (0xffffc670)
    "isearch-process-search-string" (0xffffc830)
    0x9807f8 PVEC_COMPILED
    "funcall" (0xffffca00)
    "with-no-warnings" (0xffffcbd8)
    "setq" (0xffffccb8)
    "if" (0xffffcd88)
    "let" (0xffffced8)
    "ad-Advice-isearch-process-search-char" (0xffffd110)
    "apply" (0xffffd108)
    "isearch-process-search-char" (0xffffd260)
    "isearch-printing-char" (0xffffd460)
    "call-interactively" (0xffffd620)
    "command-execute" (0xffffd788)
    (gdb) 
    (gdb) 
    


    2014年03月06日(木) 旧暦 [n年日記] [更新:"2014/03/06 21:35:35"]

    #1 [Perl] Getopt::Std not installed

    Getopt::Std; は愛用しているつもりだが、古いのかな
    Can't locate Getopt/std.pm in @INC (you may need to install the Getopt::std module) 
    (@INC contains:
    /usr/pkg/lib/perl5/site_perl/5.18.0/i386-netbsd-thread-multi
    /usr/pkg/lib/perl5/site_perl/5.18.0
    /usr/pkg/lib/perl5/vendor_perl/5.18.0/i386-netbsd-thread-multi
    /usr/pkg/lib/perl5/vendor_perl/5.18.0
    /usr/pkg/lib/perl5/5.18.0/i386-netbsd-thread-multi
    /usr/pkg/lib/perl5/5.18.0 .) at ...
    
    Core module に入っているとあるが、(僕には)まだ見つからない
    ==>  /export/CHROOT/usr/pkgsrc/devel/p5-Getopt-ArgvFile/DESCR <==
    This module simply interpolates option file hints in @ARGV by the
    contents of the pointed files. This enables option reading from files
    instead of or additional to the usual reading from the command line.
    
    Alternatively, you can process any array instead of @ARGV which is
    used by default and mentioned mostly in this manual.
    
    The interpolated @ARGV could be subsequently processed by the usual
    option handling, e.g. by a Getopt::xxx module. Getopt::ArgvFile does
    not perform any option handling itself, it only prepares the array
    
    ==>  /export/CHROOT/usr/pkgsrc/devel/p5-Getopt-Euclid/DESCR <==
    The Perl 5 module Getopt::Euclid uses your program's own documentation
    to create a command-line argument parser. This ensures that your
    program's documented interface and its actual interface always
    agree.
    
    ==>  /export/CHROOT/usr/pkgsrc/devel/p5-Getopt-Long-Descriptive/DESCR <==
    The Perl 5 module Getopt::Long::Descriptive provides a convenient
    wrapper for Getopt::Long and program usage output.
    
    ==>  /export/CHROOT/usr/pkgsrc/devel/p5-Getopt-Long/DESCR <==
    The Getopt::Long module implements an extended getopt function
    called GetOptions(). This function adheres to the POSIX syntax for
    command line options, with GNU extensions. In general, this means
    that options have long names instead of single letters, and are
    introduced with a double dash "--". Support for bundling of command
    line options, as was the case with the more traditional single-letter
    approach, is provided but not enabled by default.
    
    ==>  /export/CHROOT/usr/pkgsrc/devel/p5-Getopt-Mixed/DESCR <==
    [This module is obsolete, but is needed for an older package]
    
    Getopt::Mixed provides GNU-style option processing for Perl 5 scripts,
    with both long and short options.  Please see the documentation at the
    end of the module for instructions on its use and licensing
    restrictions.
    
    ==>  /export/CHROOT/usr/pkgsrc/devel/p5-Getopt-Simple/DESCR <==
    The Getopt::Simple perl module provides a simple way of specifying:
        * Command line switches
        * Type information for switch values
        * Default values for the switches
        * Help text per switch
    
    ==>  /export/CHROOT/usr/pkgsrc/wip/p5-Getopt-GUI-Long/DESCR <==
    This module is a wrapper around Getopt::Long that extends the value of
    the original Getopt::Long module to:
    
    1) add a simple graphical user interface option screen if no arguments
       are passed to the program.
    2) provide an auto-help mechanism such that -h and --help are handled
       automatically.
    
    It's designed to make the creation of graphical shells trivial without the
    programmer having to think about it much as well as providing automatic
    
    -Simple と -Long を入れて見たが、Getopt::Std; はなかった

    /usr/pkg/lib/perl5/5.18.0/Getopt:

    初めから入っているようだ。変だな。
    cf-r4-RF@makoto 21:17:45/140306(..emacs-book/work)% ls /usr/pkg/lib/perl5/5.18.0/Getopt
    Long.pm Std.pm
    
    これ、最初の @INC にもある PATH だな。どうも
    Getopt::std; 
    
    と書いてあるのが良くない(間違い)で s を大文字にして、
    Getopt::Std; 
    
    なのかな。どうもそうらしい。(この日記を書き始めた時には題名に Getopt::Std; と書いていた)



    最近の日記
    2024年07月03日
    kicad oddity
    2024年05月08日
    comparison on ./buildsh tools
    2024年05月06日
    py-setuptools (python 3.11.9)
    make release took 1 hours and 10 min
    qemu invocation for 10.99.10
    2024年05月05日
    Windows 10 version
    serial connection
    bc bench
    2024年05月04日
    Trial on 10.99.10
    another version (later trial) to succeed
    以上、12 日分です。
    タイトル一覧
    カテゴリ分類
    Powered by hns-2.19.9, HyperNikkiSystem Project

    Count.cgi (since 2000/02/05)