Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Simple Developer
Simple Developer
현재 제로보드 XE에 적용되어 있는 이슈트래커는 리눅스 기반에 설치되어야만 정상적으로 동작이 가능하다.
왜 윈도우나 맥에서는 동작되지 않는지 분석해 본 결과 각 운영체제별로 줄바꿈 문자에 대한 처리가 틀려 나타난 현상이였다.
각 운영체제별 줄바꿈 문자는 아래와 같은 구성으로 이루어져 있다.
윈도우 : 캐리지 리턴(Cr) & 라인 피드(Lf)
리눅스 : 라인 피드(Lf)
맥 : 캐리지 리턴(Cr)
그러므로, 각 줄바꿈 문자를 통일되게 하나의 형식으로 변환해주면 정상적인 사용이 가능하다.
/modules/issuetracker/classes/svn.class.phpgetList 함수
function getList($path, $revs = null) {
if(substr($path,0,1)==’/’) $path = substr($path,1);
if(strpos($path,’..’)!==false) return;
$command = sprintf(
‘{83832c2e9762d7d59158bb8e184331dad143c7b73eb69f86229ee6e276689139}s –non-interactive {83832c2e9762d7d59158bb8e184331dad143c7b73eb69f86229ee6e276689139}s –config-dir {83832c2e9762d7d59158bb8e184331dad143c7b73eb69f86229ee6e276689139}s list {83832c2e9762d7d59158bb8e184331dad143c7b73eb69f86229ee6e276689139}s{83832c2e9762d7d59158bb8e184331dad143c7b73eb69f86229ee6e276689139}s{83832c2e9762d7d59158bb8e184331dad143c7b73eb69f86229ee6e276689139}s’,
$this->svn_cmd,
$this->_getAuthInfo(),
$this->tmp_dir,
$this->url,
$path,
$revs?’@’.(int)$revs:null
);
$buff = $this->execCmd($command, $error);
// 운영체제 별 줄바꿈 문자 처리가 틀리므로 n으로 통일시키기
$buff = str_replace(array(“rn”, “r”), “n”, $buff);
$list = explode(“n”,$buff);
if(!count($list)) return null;
$file_list = $directory_list = $output = array();
foreach($list as $name) {
if(!$name) continue;
$obj = null;
$obj->name = $name;
$obj->path = $path.$name;
$logs = $this->getLog($obj->path, $revs, null, false, 1);
$obj->revision = $logs[0]->revision;
$obj->author = $logs[0]->author;
$obj->date = $this->getDateStr(“Y-m-d H:i”,$logs[0]->date);
$obj->gap = $this->getTimeGap($logs[0]->date);
$obj->msg = $this->linkXE($logs[0]->msg);
if(substr($obj->path,-1)==’/’) $obj->type = ‘directory’;
else $obj->type = ‘file’;
if($obj->type == ‘file’) $file_list[] = $obj;
else $directory_list[] = $obj;
}
return array_merge($directory_list, $file_list);
}
위의 코드의 18행에서처럼 줄바꿈 문자인 ‘n’ 을 이용하여 분리하기 전에 윈도우와 맥의 줄바꿈 문자인 ‘rn’ ,’r’ 을 먼저 ‘n’ 으로 치환하고 분리하게 되면 정상적인 동작이 가능하다.