From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Jun 1 03:10:27 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F56416A4CE for ; Tue, 1 Jun 2004 03:10:27 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8658D43D49 for ; Tue, 1 Jun 2004 03:10:27 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i51AAFh3038823 for ; Tue, 1 Jun 2004 03:10:15 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i51AAFUh038822; Tue, 1 Jun 2004 03:10:15 -0700 (PDT) (envelope-from gnats) Resent-Date: Tue, 1 Jun 2004 03:10:15 -0700 (PDT) Resent-Message-Id: <200406011010.i51AAFUh038822@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dmitry A Grigorovich Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 170CD16A4CE for ; Tue, 1 Jun 2004 03:07:56 -0700 (PDT) Received: from pierino.bionet.nsc.ru (pierino.bionet.nsc.ru [193.125.179.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id BEA8943D5D for ; Tue, 1 Jun 2004 03:07:53 -0700 (PDT) (envelope-from odip@pierino.bionet.nsc.ru) Received: from pierino.bionet.nsc.ru (localhost [127.0.0.1]) i51A7iRl029227 for ; Tue, 1 Jun 2004 17:07:44 +0700 (NOVST) (envelope-from odip@pierino.bionet.nsc.ru) Received: (from odip@localhost) by pierino.bionet.nsc.ru (8.12.8p1/8.12.8/Submit) id i51A7hBh029226; Tue, 1 Jun 2004 17:07:43 +0700 (NOVST) (envelope-from odip) Message-Id: <200406011007.i51A7hBh029226@pierino.bionet.nsc.ru> Date: Tue, 1 Jun 2004 17:07:43 +0700 (NOVST) From: Dmitry A Grigorovich To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/67445: [PATCH] mirror don't fetch files with $ in names when update_local=yes X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Dmitry A Grigorovich List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2004 10:10:27 -0000 >Number: 67445 >Category: ports >Synopsis: [PATCH] mirror don't fetch files with $ in names when update_local=yes >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jun 01 03:10:14 PDT 2004 >Closed-Date: >Last-Modified: >Originator: Dmitry A Grigorovich >Release: FreeBSD 4.8-RELEASE i386 >Organization: ICiG SB RAS >Environment: System: FreeBSD pierino.bionet.nsc.ru 4.8-RELEASE FreeBSD 4.8-RELEASE #5: Sat Oct 4 02:28:14 NOVST 2003 root@pierino.bionet.nsc.ru:/usr/obj/usr/src/sys/ODIP i386 >Description: Use port ftp/mirror and include update_local=yes in config This mean, that mirror must update only files, which present in local directory To do this mirror scan local directory and build get_patt pattern. Pattern get_patt have perl RE syntax, like '^file1$|^file2$'. This pattern must match only local files and no more. Next step, mirror list remote files and update only files, which match get_patt. But mirror incorrectly build get_patt pattern if file name have special characters like '^', '$' and other. Pattern don't match this files and accordingly mirror don't update this files from remote site. >How-To-Repeat: 1) Create file config with content: package=test comment=test site=ftp.bionet.nsc.ru passive_ftp=true # where to start pulling files back from remote_dir=/test # where to put the files on your machine local_dir=/home/odip/mirror/local update_local=yes 2) Put non empty files to ftp://ftp.bionet.nsc.ru/test/ with names: normal_file, $bad_file, bad_file$ root# ls -l /home/ftp/test total 6 -rw-r--r-- 1 root wheel 9 Jun 1 16:44 $bad_file -rw-r--r-- 1 root wheel 9 Jun 1 16:44 bad_file$ -rw-r--r-- 1 root wheel 12 Jun 1 16:16 normal_file 3) Create empty dir local Create empty files with names: normal_file, $bad_file, bad_file$ odip$ ls -l local total 0 -rw-r--r-- 1 odip odip 0 1 ÉÀÎ 16:58 $bad_file -rw-r--r-- 1 odip odip 0 1 ÉÀÎ 16:58 bad_file$ -rw-r--r-- 1 odip odip 0 1 ÉÀÎ 16:58 normal_file 4) Run mirror in debug mode odip@hydra$ mirror -d -p test ./config package=test ftp.bionet.nsc.ru:/test -> /home/odip/mirror/local Scanning local directory /home/odip/mirror/local get_patt = ^$bad_file|^bad_file$|^normal_file Scanning remote directory /test compare directories (src 3, dest 3) No files to transfer unlink /home/odip/mirror/local/bad_file$ unlink /home/odip/mirror/local/$bad_file disconnecting from ftp.bionet.nsc.ru All done, Exiting ERROR: get_patt in invalid and mirror remove two files !!! 5) Show local directory odip@hydra$ ls -l local total 2 -r--r--r-- 1 odip odip 12 1 ÉÀÎ 09:16 normal_file >Fix: Put follow file into /usr/ports/ftp/mirror/files Remove port ftp/mirror Build and install port ftp/mirror --- patch-ba begins here --- --- mirror.pl.orig Thu Aug 7 11:47:06 2003 +++ mirror.pl Fri Apr 30 14:21:48 2004 @@ -1323,8 +1323,11 @@ # Create a get_patt from the contents of the local directory if( $update_local && $#get_top >= 0 ){ - $get_patt = '^' . join( '|^', @get_top ); - $get_patt =~ s/$squished//g; + my ($path,$re,@re_patt); + #$get_patt = '^' . join( '|^', @get_top ); + #$get_patt =~ s/$squished//g; + foreach $path ( @get_top ) { push @re_patt, "\^\Q$path\E\$"; } + $get_patt= join( '|', @re_patt ); &msg( "get_patt = $get_patt\n" ) if $debug; } --- patch-ba ends here --- Try again test above 3) Create empty dir local Create empty files with names: normal_file, $bad_file, bad_file$ odip$ ls -l local total 0 -rw-r--r-- 1 odip odip 0 1 ÉÀÎ 17:03 $bad_file -rw-r--r-- 1 odip odip 0 1 ÉÀÎ 17:03 bad_file$ -rw-r--r-- 1 odip odip 0 1 ÉÀÎ 17:04 normal_file 4) Run mirror in debug mode odip@hydra$ mirror -d -p test ./config package=test ftp.bionet.nsc.ru:/test -> /home/odip/mirror/local Scanning local directory /home/odip/mirror/local get_patt = ^\$bad_file$|^bad_file\$$|^normal_file$ Scanning remote directory /test compare directories (src 3, dest 3) Got bad_file$ 9 0 Got $bad_file 9 0 Got normal_file 12 0 disconnecting from ftp.bionet.nsc.ru All done, Exiting 5) Show local directory odip@hydra$ ls -l local total 6 -r--r--r-- 1 odip odip 9 1 ÉÀÎ 09:44 $bad_file -r--r--r-- 1 odip odip 9 1 ÉÀÎ 09:44 bad_file$ -r--r--r-- 1 odip odip 12 1 ÉÀÎ 09:16 normal_file All is ok - files mirrored >Release-Note: >Audit-Trail: >Unformatted: