From 4fe9d57ed89c70a5467cfadfa4f92c713c2b3e2e Mon Sep 17 00:00:00 2001
From: Roy Ivy III
Date: Wed, 24 Jun 2015 11:28:51 -0500
Subject: [PATCH] FIX portable perl to allow normal access to user's home
directory
* disable the File::HomeDir override performed by Portable.pm
- achieved by removing the HomeDir section from "portable.perl" via post_install
- ref: https://rt.cpan.org/Ticket/Display.html?id=105395 @@ https://archive.is/q7BYq
.# DISCUSSION
Strawberry Portable Perl is written to be usable from a non-privileged
storage location, such as a plug-in USB drive. So, it is designed to be
usable without access to the host filesystem beyond it's own directory.
As part of the machinations making this possible, Portable.pm overrides
File::HomeDir to return resultant paths which are within the perl installation
directory (specifically, "/data"). Obviously, this obscures the
user's true home directory and can be very inconvenient for common perl
scripts which depend on access to data within the user's home directory
(i.e., reading ".netrc").
This override/redirection is unnecessary for an installation by the user
into the usual host filesystem (such as is done via `scoop`). Such an
install has user level privileges and will be able to access any
user-accessible portion of the file system.
---
perl.json | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/perl.json b/perl.json
index 68d72784bb..7e4225cce5 100644
--- a/perl.json
+++ b/perl.json
@@ -12,6 +12,12 @@
"hash": "sha1:844e7c2d741bda915ece0688bf3a00ab12577460"
}
},
+ "post_install":"
+ # enable standard idiomatic access to user's home directory
+ ## remove HomeDir section from portable.perl (disables Portable.pm override of File::HomeDir)
+ ## NOTE: conversion to byte[] avoids adding an extra trailing newline to the output file
+ [byte[]][char[]]((Get-Content -raw $dir\\portable.perl) -replace \"(?ms)^HomeDir:.*?^(?=\\S)\",\"\") | Set-Content $dir\\portable.perl -encoding byte
+ ",
"env_add_path": [ "perl\\site\\bin", "perl\\bin", "c\\bin" ],
"checkver": "Recommended version:
\\s*]*>Strawberry Perl ([0-9\\.]+) \\(32bit\\)"
}