[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[debian-users:29644] Re: Samba sjis file restore
- From: Taketoshi Sano <kgh12351@xxxxxxxxxxx>
- Subject: [debian-users:29644] Re: Samba sjis file restore
- Date: Sun, 26 Aug 2001 04:31:03 +0900
- X-dispatcher: imput version 991025(IM133)
- X-fingerprint: A1A0 F2D0 9C5D 7D61 DBA1 1507 D0B3 F3D0 AE31 C009
- X-ml-info: If you have a question, send e-mail with the body "help" (without quotes) to the address debian-users-ctl@debian.or.jp; help=<mailto:debian-users-ctl@debian.or.jp?body=help>
- X-ml-name: debian-users
- X-mlserver: fml [fml 3.0pl#17]; post only (only members can post)
- References: <3B845A5E.6060409@xxxxxxxxx>
- Message-id: <y5apu9kshwo.fsf@xxxxxxxxxxxxxxxxxxxx>
- X-mail-count: 29644
- User-agent: Semi-gnus/6.10.12 SEMI/1.12.1 ([JR] Nonoichi) FLIM/1.12.7 (Yþzaki) Emacs/20.7 (i386-debian-linux-gnu) MULE/4.0 (HANANOEN)
ä½é‡Žï¼ 浜æ¾ã§ã™ã€‚
In <3B845A5E.6060409@xxxxxxxxx>,
on "Thu, 23 Aug 2001 10:19:53 +0900',
with "[debian-users:29618] Samba sjis file restore",
Tomoo Nmura <nomurat@xxxxxxxxx> ã•ã‚“ wrote:
> Samba ã®ãƒ•ã‚¡ã‚¤ãƒ«å…±æœ‰ã‚’ã€coding system = sjis ã§é‹ç”¨ã—ã¦ã„ã¾ã—ãŸã€‚
> ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã‚’ tar -cf /dev/nst0 * ã¨ã—ã¦å–ã£ã¦ã„ãŸã®ã§ã™ãŒã€å¾©å…ƒã§
> ããšã«å›°ã£ã¦ã„ã¾ã™ã€‚
復元ã ã‘ãŒã§ããªã„ã®ã§ã™ã ? ãã‚‚ãもアーカイブã«å…¥ã£ã¦ã„ãªã„
ã¨ã„ã†ã“ã¨ã§ã¯ç„¡ã ?
(åå‰ã« "/" ãŒå…¥ã£ã¦ã„ã‚‹ã€ã¨ã„ã†ã‚ˆã†ãªè©±ã ã¨ã€ãã‚‚ãã‚‚
ãã†ã—ãŸãƒ•ã‚¡ã‚¤ãƒ«ã‚’作æˆã§ããªã„よã†ãªæ°—ãŒã™ã‚‹ã®ã§ã€
tar ã§ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã™ã‚‹ã“ã¨ã‚‚ç„¡ç†ã ã‚ã†ãªã€ã¨ã€‚)
sjis ã§ã‚„ã£ãŸã“ã¨ã¯ç„¡ã„ã®ã§ã™ãŒã€cap ã§é‹ç”¨ã—ã¦ã„ã¦ã€ãƒ•ã‚¡ã‚¤ãƒ«åã«
例ãˆã° ' (single quote) ã¨ã‹ " (double quote) ã¨ã‹ã‚ã‚‹ã„ã¯ã‚¹ãƒšãƒ¼ã‚¹
ãªã©ãŒå«ã¾ã‚Œã¦ã„ã‚‹ãŸã‚ã«ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ— (アーカイブã®ä½œæˆ) 自体ãŒã†ã¾ã
ã„ã‹ãªã„ã€ã¨ã„ã†è©±ã¯ä»¥å‰çµŒé¨“ã—ãŸã“ã¨ãŒã‚ã£ãŸã‚ˆã†ãªæ°—ãŒã™ã‚‹ã‚“ã ã‘ã©ã€
別ãªè©±ã ã£ãŸã‹ãª ?
ãã®æ™‚ã¯ãŸã—ã‹ find ã® -print0 オプション㨠xargs ã® -0 オプションを
使ã£ã¦å¯¾å‡¦ã—ãŸã¯ãšãªã®ã§ã™ãŒã€‚
> ã‚ã‚‹sjisåã®ãƒ•ã‚©ãƒ«ãƒ€ãƒ¼ã‚’復元ã—ãŸã„ã®ã§ã™ãŒã€
>
> tar -xvf /dev/nst0 アイウエオ
>
> ã¨ã™ã‚‹ã¨ã€ãƒ•ã‚¡ã‚¤ãƒ«åã®ã¨ã“ã‚ã«ã‚³ãƒ³ãƒˆãƒãƒ¼ãƒ«ã‚³ãƒ¼ãƒ‰ãŒå…¥ã‚‹ã®ã‹ã€
> ã†ã¾ãè¡Œãã¾ã›ã‚“。
試ã—ã« sjis ã§ã€Œã‚¢ã‚¤ã‚¦ã‚¨ã‚ªã€ã¨ã„ã†åå‰ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’作ã£ã¦ã¿ã¾ã—ãŸãŒ
別ã«å•é¡Œç„¡ã•ãã†ã§ã™ã€‚
$ mkdir $(echo アイウエオ|nkf -s)
$ ls -lsaR|nkf
.:
åˆè¨ˆ 12
4 drwxrwxrwx 3 root root 4096 Aug 25 15:45 .
4 drwxrwxrwt 9 root root 4096 Aug 25 15:36 ..
4 drwxrwxr-x 2 sano sano 4096 Aug 25 15:45 アイウエオ
./アイウエオ:
ケ邱ラ 8
4 drwxrwxr-x 2 sano sano 4096 Aug 25 15:45 .
4 drwxrwxrwx 3 root root 4096 Aug 25 15:45 ..
$ touch $(echo アイウエオ|nkf -s)/$(echo ã“ã‚Œã¯ãƒ•ã‚¡ã‚¤ãƒ«ã§ã™ã€‚|nkf -s)
$ ls -lsaR|nkf -e
.:
åˆè¨ˆ 12
4 drwxrwxrwx 3 root root 4096 Aug 25 15:45 .
4 drwxrwxrwt 9 root root 4096 Aug 25 15:36 ..
4 drwxrwxr-x 2 sano sano 4096 Aug 25 15:46 アイウエオ
./アイウエオ:
ケ邱ラ 8
4 drwxrwxr-x 2 sano sano 4096 Aug 25 15:46 .
4 drwxrwxrwx 3 root root 4096 Aug 25 15:45 ..
0 -rw-rw-r-- 1 sano sano 0 Aug 25 15:46 ã“ã‚Œã¯ãƒ•ã‚¡ã‚¤ãƒ«ã§ã™ã€‚
$ tar -cvzf sjis.tgz ./$(echo アイウエオ|nkf -s)
./\203A\203C\203E\203G\203I/
./\203A\203C\203E\203G\203I/\202202202203t\203@\203C\203\213\202202201B
[pika] $ tar -tvzf sjis.tgz
drwxrwxr-x sano/sano 0 2001-08-25 15:46:00 ./\203A\203C\203E\203G\203I/
-rw-rw-r-- sano/sano 0 2001-08-25 15:46:00 ./\203A\203C\203E\203G\203I/\202202202203t\203@\203C\203\213\202202201B
[pika] $ mkdir check
[pika] $ cd check
[pika] $ tar -xvzf ../sjis.tgz
./\203A\203C\203E\203G\203I/
./\203A\203C\203E\203G\203I/\202202202203t\203@\203C\203\213\202202201B
[pika] $ ls -lsaR|nkf -e
.:
åˆè¨ˆ 12
4 drwxrwxr-x 3 sano sano 4096 Aug 25 15:46 .
4 drwxrwxrwx 4 root root 4096 Aug 25 15:46 ..
4 drwxrwxr-x 2 sano sano 4096 Aug 25 15:46 アイウエオ
./アイウエオ:
ケ邱ラ 8
4 drwxrwxr-x 2 sano sano 4096 Aug 25 15:46 .
4 drwxrwxr-x 3 sano sano 4096 Aug 25 15:46 ..
0 -rw-rw-r-- 1 sano sano 0 Aug 25 15:46 ã“ã‚Œã¯ãƒ•ã‚¡ã‚¤ãƒ«ã§ã™ã€‚
「å•é¡ŒãŒç™ºç”Ÿã—ãŸãƒ•ã‚¡ã‚¤ãƒ«åã€ã¨ã„ã†ã®ã¯ã€Œã‚¢ã‚¤ã‚¦ã‚¨ã‚ªã€ã§ã¯ãªã
何ã‹åˆ¥ãªã‚‚ã®ã§ã™ã。
例ãˆã°
tar -tvzf ./sjis.tgz |
perl -ne
'chomp; $name=$_; s/\\([0-7][0-7][0-7])/pack('c',oct($1))/ge;print $_ . "\n";'
|nkf -e
ã¿ãŸã„ã«ã™ã‚Œã° sjis encoded ãªãƒ•ã‚¡ã‚¤ãƒ«åã§ã‚‚リストをå–れるã¨æ€ã„ã¾ã™ãŒã€
ã©ã‚ŒãŒã€Œå•é¡Œã®ç™ºç”Ÿã™ã‚‹æ–‡å—ã€ãªã®ã‹ã€ç‰¹å®šã§ãã¾ã™ã‹ ?
drwxrwxr-x sano/sano 0 2001-08-25 16:25:17 アイウエオ/
-rw-rw-r-- sano/sano 0 2001-08-25 15:46:00 アイウエオ/ã“ã‚Œã¯ãƒ•ã‚¡ã‚¤ãƒ«ã§ã™ã€‚
-rw-rw-r-- sano/sano 16 2001-08-25 16:25:05 アイウエオ/試行錯誤ã€æ—¥ã€…是精進
> ã—ã‹ãŸãªãã€å…¨éƒ¨å¾©å…ƒã—よã†ã¨æ€ã„ã€
>
> tar -xvf /dev/nst0 *
>
> ã¨ã—ãŸã®ã§ã™ãŒã€ã‚„ã¯ã‚Šã‚るファイルã®ã¨ã“ã‚ã§ã€ã ã‚“ã¾ã‚Šã«ãªã‚Šã¾ã™ã€‚
>
> tar -xvf /dev/nst0 \205k\201[........
>
> ã¨ã„ã†ãµã†ã«ãƒ•ã‚¡ã‚¤ãƒ«åを指定ã™ã‚‹ã®ã‹ã¨ã‚‚æ€ã£ãŸã®ã§ã™ãŒã€
> ã“ã‚Œã§ã¯ã ã‚ãªã‚ˆã†ã§ã™ã€‚
> sjisåã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’復元ã™ã‚‹ã«ã¯ã€ã©ã®ã‚ˆã†ã«æŒ‡å®šã—ãŸã‚‰ã‚ˆã„ã®ã§ã—ょã†ã‹ï¼Ÿ
「ã‚るファイルã€ã¨ã„ã†æƒ…å ±ã ã‘ã§ã¯ã€ã©ã†ã„ã†ç¾è±¡ãŒèµ·ãã¦ã„ã‚‹ã®ã‹
ã‚ã‹ã‚Šã¾ã›ã‚“ã‹ã‚‰ã“ã‚Œã§ã¯ãƒ€ãƒ¡ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“ãŒã€ä¸€å¿œä»¥ä¸‹ã®ã‚ˆã†ãª
ã“ã¨ã¯æ‰‹å…ƒã® potato ã§ã¯å®Ÿè¡Œå¯èƒ½ã§ã™ã€‚(上記ã§ä½œæˆã—㟠tar file ã‚’
使用ã—ã¦ã„ã¾ã™)
$ cat >filename01.txt (終了㯠Ctrl-D ã§)
./アイウエオ/ã“ã‚Œã¯ãƒ•ã‚¡ã‚¤ãƒ«ã§ã™ã€‚^@./アイウエオ^@ $
$ nkf -s filename01.txt >filename01.sjis
$ tar --null -T filename01.sjis -tvzf ../sjis.tgz
drwxrwxr-x sano/sano 0 2001-08-25 15:46:00 ./\203A\203C\203E\203G\203I/
-rw-rw-r-- sano/sano 0 2001-08-25 15:46:00 ./\203A\203C\203E\203G\203I/\202202202203t\203@\203C\203\213\202202201B
$ tar --null -T filename01.sjis -xvzf ../sjis.tgz
./\203A\203C\203E\203G\203I/
./\203A\203C\203E\203G\203I/\202202202203t\203@\203C\203\213\202202201B
$ ls -lsaR |nkf -e
.:
åˆè¨ˆ 28
4 drwxrwxr-x 3 sano sano 4096 Aug 25 16:20 .
4 drwxrwxrwx 4 root root 4096 Aug 25 15:46 ..
4 -rw-rw-r-- 1 sano sano 47 Aug 25 16:18 filename01.sjis
4 -rw-rw-r-- 1 sano sano 47 Aug 25 16:18 filename01.txt
4 -rw-rw-r-- 1 sano sano 47 Aug 25 16:19 filename02.sjis
4 -rw-rw-r-- 1 sano sano 47 Aug 25 16:19 filename02.txt
4 drwxrwxr-x 2 sano sano 4096 Aug 25 15:46 アイウエオ
./アイウエオ:
ケ邱ラ 8
4 drwxrwxr-x 2 sano sano 4096 Aug 25 15:46 .
4 drwxrwxr-x 3 sano sano 4096 Aug 25 16:20 ..
0 -rw-rw-r-- 1 sano sano 0 Aug 25 15:46 ã“ã‚Œã¯ãƒ•ã‚¡ã‚¤ãƒ«ã§ã™ã€‚
$ rm -rf $(echo アイウエオ|nkf -s)
$ ls -lsaR
.:
åˆè¨ˆ 24
4 drwxrwxr-x 2 sano sano 4096 Aug 25 16:21 .
4 drwxrwxrwx 4 root root 4096 Aug 25 15:46 ..
4 -rw-rw-r-- 1 sano sano 47 Aug 25 16:18 filename01.sjis
4 -rw-rw-r-- 1 sano sano 47 Aug 25 16:18 filename01.txt
4 -rw-rw-r-- 1 sano sano 47 Aug 25 16:19 filename02.sjis
4 -rw-rw-r-- 1 sano sano 47 Aug 25 16:19 filename02.txt
ã“ã“ã§ã¡ã‚‡ã£ã¨é¢ç™½ã„ã“ã¨ã«ã€ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªåã¨ãƒ•ã‚¡ã‚¤ãƒ«åã®é †ç•ªã‚’
逆ã«ã™ã‚‹ã¨ã†ã¾ãã„ãã¾ã›ã‚“ã。
$ cat >filename02.txt
./アイウエオ^@./アイウエオ/ã“ã‚Œã¯ãƒ•ã‚¡ã‚¤ãƒ«ã§ã™ã€‚^@ $ hex filename02.txt
0x00000000: 2e 2f a5 a2 a5 a4 a5 a6 - a5 a8 a5 aa 00 2e 2f a5 ./アイウエオ@./ア
0x00000010: a2 a5 a4 a5 a6 a5 a8 a5 - aa 2f a4 b3 a4 ec a4 cf .イウエオ/ã“ã‚Œã¯
0x00000020: a5 d5 a5 a1 a5 a4 a5 eb - a4 c7 a4 b9 a1 a3 00 ファイルã§ã™ã€‚@
$ nkf -s filename02.txt >filename02.sjis
$ tar --null -T filename02.sjis -tvzf ../sjis.tgz
drwxrwxr-x sano/sano 0 2001-08-25 15:46:00 ./\203A\203C\203E\203G\203I/
-rw-rw-r-- sano/sano 0 2001-08-25 15:46:00 ./\203A\203C\203E\203G\203I/\202202202203t\203@\203C\203\213\202202201B
tar: ./\203A\203C\203E\203G\203I/\202202202203t\203@\203C\203\213\202202201B: 書庫ä¸ã«è¦‹ã¤ã‹ã‚Šã¾ã›ã‚“
tar: エラー終了ãŒå‰ã®ã‚¨ãƒ©ãƒ¼ã‹ã‚‰é…ã‚Œã¾ã—ãŸ
ã“ã‚Œã¯æœ€åˆã® ./アイウエオ 㧠./アイウエオ 以下ã®ãƒ•ã‚¡ã‚¤ãƒ«ãŒå±•é–‹ã•ã‚Œã¦
ã—ã¾ã†ãŸã‚ã«ãれ以é™ã®ãƒ•ã‚¡ã‚¤ãƒ«ãŒè¦‹ã¤ã‹ã‚‰ãªã„ã€ã¨ã„ã†ã“ã¨ãªã‚“ã§ã—ょã†ã‹ã€‚
ä»–ã®ä¾‹ã§è©¦ã—ã¦ã¿ã‚‹ã¨ã€
$ tar -tvzf test.tgz test1/ test1/test2/test3
drwxrwxr-x sano/sano 0 2001-08-25 16:36:33 test1/
drwxrwxr-x sano/sano 0 2001-08-25 16:36:38 test1/test2/
-rw-rw-r-- sano/sano 0 2001-08-25 16:36:38 test1/test2/test3
tar: test1/test2/test3: 書庫ä¸ã«è¦‹ã¤ã‹ã‚Šã¾ã›ã‚“
tar: エラー終了ãŒå‰ã®ã‚¨ãƒ©ãƒ¼ã‹ã‚‰é…ã‚Œã¾ã—ãŸ
$ tar -tvzf test.tgz test1/test2/test3 test1/
drwxrwxr-x sano/sano 0 2001-08-25 16:36:33 test1/
drwxrwxr-x sano/sano 0 2001-08-25 16:36:38 test1/test2/
-rw-rw-r-- sano/sano 0 2001-08-25 16:36:38 test1/test2/test3
別ã«ãƒ•ã‚¡ã‚¤ãƒ«åã®ã‚³ãƒ¼ãƒ‰ãŒ ASCII ã§ã‚‚åŒã˜å‹•ä½œã¿ãŸã„ã§ã™ã。
--
# (ã‚ãŸã—ã®ãŠã†ã¡ã¯æµœæ¾å¸‚ã€ã€Œå¤œã®ãŠè“åã€ã§æœ‰åã•ã€‚)
<kgh12351@xxxxxxxxxxx> : Taketoshi Sano (ä½é‡Žã€€æ¦ä¿Š)