SFTP는 SSH의 일부인 FTP 하위 시스템으로, 암호화된 파일 전송을 가능하게 합니다. 지난주 동안 SFTP를 통해 파일이 제대로 전송되지 않는 문제가 두 건 발생했습니다. 한 건은 OpenVOS가 파일의 송신원이었고, 다른 한 건은 OpenVOS가 파일을 수신하는 상황이었습니다. 두 경우 모두 파일에는 ASCII 데이터가 포함되어 있었으며, 문제는 Microsoft Windows와 OpenVOS가 텍스트 파일의 줄을 종료하는 방식의 차이에서 비롯되었습니다.
먼저 OpenVOS를 예로 들어보겠습니다. 선호하는 편집기를 사용하여 텍스트 파일을 만들면 순차 파일이 생성됩니다. 예를 들어
d test %phx_vos#m16_mas>SysAdmin>Noah_Davids>test 10-09-05 08:13:49 mst 1234567890
|
display_file_status testname: %phx_vos#m16_mas>SysAdmin>Noah_Davids>testfile organization: sequential file. . . next byte: 20blocks used: 1. . . record count: 2data byte count: 10
|
dump_file test%phx_vos#m16_mas>시스템 관리자>Noah_Davids>테스트 2010년 9월 5일 08:14:07 (MST)블록 번호 1000 00053132 333435FF 00050005 36373839 |..12345…..6789|010 30FF0005 FFFFFFFF FFFFFFFF FFFFFFFF |0……………|020 FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |…………….| = FF0 FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |…………….| 준비됨 08:14:07 |
C:Documents and SettingsnoahMy Documentstemp>"C:Program FilesPuTTYpsftp" [email protected]Using username "nd".[email protected]'s password:Remote working directory is /SysAdmin/Noah_Davidspsftp> get test test.txtremote:/SysAdmin/Noah_Davids/test => local:test.txtpsftp> quit C:Documents and SettingsnoahMy Documentstemp>dir Volume in drive C has no label. Volume Serial Number is 38B1-9C13 Directory of C:Documents and SettingsnoahMy Documentstempblog - sftp 08/27/2010 01:50 PM <DIR> .08/27/2010 01:50 PM <DIR> ..08/27/2010 01:50 PM 12 test.txt 1 File(s) 12 bytes 2 Dir(s) 39,471,644,672 bytes free |
|
%phx_vos#m16_mas>SysAdmin>Noah_Davids>pc1.txt 2010-09-05 08:52:21 (MST) 000 61626364650D0A666768696A 0D0AFFFF |abcde..fghij….| 010 FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |…………….| = FF0 FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |…………….| 준비됨 08:52:21 |
|
%phx_vos#m16_mas>시스템 관리자>Noah_Davids>pc1.txt 2010년 9월 5일 08:54:25 (MST) abcde fghij 준비됨 08:54:25 |
test_system_calls tsc: s$attach_port p pc1.txt tsc: s$opentsc: s$seq_read pBuffer length = 600000000 61626364 650D |abcde. |tsc: s$seq_read pBuffer length = 600000000 66676869 6A0D |fghij. |
|
# cr.pl begins here## cr# version 1.0 10-08-27#use strict;use warnings;use Getopt::Long; my ($inFile, $outFile, @files, $add, $remove);my ($INFILE);my ($result, $count, $verbose, $addremove); $result = GetOptions ('in=s' => $inFile, 'out=s' => $outFile, 'add' => $add, 'remove' => $remove, 'verbose=s' => $verbose);if (($result != 1) || !defined ($inFile) || !defined ($outFile)) { print "nnUsage:n"; print "perl cr.pl -in PATH -out PATH [[-add] | [-remove]] [-verbose]}n"; exit; } if (defined ($add) && defined ($remove)) { print "You can only specify -add or -remove not bothnn"; print "nnUsage:n"; print "perl cr.pl -in PATH -out PATH [[-add] | [-remove]] [-verbose]}n"; exit; } @files = glob ($inFile);if (@files < 1) {print "nNo files found for " . $inFile . "nn";}if (@files > 1) {print "nMore than 1 file found for " . $inFile . "nn";} open (OUT, ">".$outFile) || die "Can't open output file " . $outFile . "nn";open ($INFILE, $files[0]) || die "Can't open input file " . $files[0] . "nn"; if (!defined ($verbose)) { $verbose = -1; } $count = 0;while ($_ = <$INFILE>) { if (defined ($remove)) { s/r//; print OUT $_ ; } else { s/n//; print OUT $_ . "rn"; } $count++; if (($verbose > 0) && ($count % $verbose) == 0) { print "Line " . $count . " of " . $files[0] . " processedn"; } } close $INFILE;#
|



