git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] Fix sed usage in tests to work around broken xpg4/sed on Solaris

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 19, 2015, 07:37 UTC
Message-ID
<fadc4ff7e755913a4c6076165556b56c@www.dscho.org>
In-Reply-To
<55AB49C1.8010105@kdbg.org>
Hi,
On 2015-07-19 08:54, Johannes Sixt wrote:
Show 19 quoted lines
> Am 18.07.2015 um 17:21 schrieb Ben Walton:
>>   	test_expect_success "clone ssh://$tuah/home/user/repo" "
>>   	  test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
>>   	"
>> diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
>> index e94b2f1..eb264f9 100755
>> --- a/t/t9500-gitweb-standalone-no-errors.sh
>> +++ b/t/t9500-gitweb-standalone-no-errors.sh
>> @@ -290,8 +290,7 @@ test_expect_success 'setup incomplete lines' '
>>   	echo "incomplete" | tr -d "\\012" >>file &&
>>   	git commit -a -m "Add incomplete line" &&
>>   	git tag incomplete_lines_add &&
>> -	sed -e s/CHANGE_ME/change_me/ <file >file+ &&
>> -	mv -f file+ file &&
>> +	perl -pi -e "s/CHANGE_ME/change_me/" file &&
> 
> This is problematic. On Windows, perl -i fails when no backup file
> extension is specified because perl attempts to replace a file that is
> still open; that does not work on Windows.
Let's qualify this a bit better: it actually works with the SDK of Git for Windows 2.x. It is therefore incomplete and partially incorrect to say "that does not work on Windows". It is true that Git for Windows 1.x' perl bails out with "Can't do inplace edit".
> This should work, but I haven't tested, yet:
> 
> 	perl -pi.bak -e "s/CHANGE_ME/change_me/" file &&
This works, of course, but it leaves an extra file behind.
I really wonder why the previous ">file+ && mv -f file+ file" dance needs to be replaced?

Ciao, Johannes

Previous: Johannes SixtNext: Johannes Sixt
Message 4 of 7 in “Fix sed usage in tests to work around broken xpg4/sed on Solaris”
  1. 2/2 Fix sed usage in tests to work around broken xpg4/sed on SolarisBen Walton, Jul 18, 2015
  2. Eric SunshineJul 19, 2015
  3. Johannes SixtJul 19, 2015
  4. Johannes SchindelinJul 19, 2015
  5. Johannes SixtJul 19, 2015
  6. Junio C HamanoJul 20, 2015
  7. Johannes SchindelinJul 22, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.