Ich verwende Perl, um eine Zeichenfolge ($ password) an eine zu interpretierende Systemzeile zu übergeben. Es scheint jedoch nicht korrekt interpretiert zu werden, denn wenn ich das Sparse Bundle anschließe, wird die Authentifizierung fehlgeschlagen. Als Anmerkung funktioniert alles nach der Pfeife gut.Perl Systemaufruf interpretiert Variable nicht korrekt
$password = chomp($password);
### Create the bash system call to create the sparse bundle with the password
my $cmd = `echo $password | hdiutil create -size 200g -type SPARSEBUNDLE -encryption -stdinpass -volname \"Encrypted Storage for Matt\" -fs \"Case-sensitive Journaled HFS+\" -verbose ~/Desktop/SparseBundle`;
Einige Beispielausgabe:
SLC1087-Matt:backups matt$ ./create_sparsebundle.pl
DIDiskImageCreatorProbe: interface 1, score 1000, CSparseBundleDiskImage
DIDiskImageCreatorProbe: interface 2, score -1000, CSparseDiskImage
DIDiskImageCreatorProbe: interface 3, score -1000, CRawDiskImage
DIDiskImageCreatorProbe: interface 7, score -1000, CWOUDIFDiskImage
DIDiskImageCreatorProbe: interface 9, score -1000, CCFPlugInDiskImage
DIDiskImageCreateWithCFURL: CSparseBundleDiskImage
CBSDBackingStore::createProbe directory, not a valid image file.
DIBackingStoreCreatorProbe: interface 0, score -1000, CBSDBackingStore
DIBackingStoreCreatorProbe: interface 1, score 1000, CBundleBackingStore
DIBackingStoreCreatorProbe: interface 2, score 0, CRAMBackingStore
DIBackingStoreCreatorProbe: interface 3, score 100, CCarbonBackingStore
DIBackingStoreCreatorProbe: interface 5, score -100, CCURLBackingStore
DIBackingStoreCreateWithCFURL: CBundleBackingStore
DIFileEncodingCreatorProbe: interface 2, score 1000, CEncryptedEncoding
DIFileEncodingCreateWithCFURL: CEncryptedEncoding
DIFileEncodingCreatorProbe: interface 2, score -1000, CEncryptedEncoding
DIBackingStoreCreatorProbe: interface 0, score 100, CBSDBackingStore
DIBackingStoreCreatorProbe: interface 1, score -1000, CBundleBackingStore
DIBackingStoreCreatorProbe: interface 2, score 0, CRAMBackingStore
DIBackingStoreCreatorProbe: interface 3, score 100, CCarbonBackingStore
DIBackingStoreCreatorProbe: interface 5, score -100, CCURLBackingStore
DIBackingStoreCreateWithCFURL: CBSDBackingStore
DIBackingStoreCreateWithCFURL: creator returned 0
DIFileEncodingCreateWithCFURL: creator returned 0
DIBackingStoreCreateWithCFURL: creator returned 0
DIDiskImageCreateWithCFURL: creator returned 0
DI_kextWaitQuiet: about to call IOServiceWaitQuiet...
DI_kextWaitQuiet: IOServiceWaitQuiet took 0.000003 seconds
2016-05-18 20:59:09.627 diskimages-helper[68122:1796245] *** -[NSMachPort handlePortMessage:]: dropping incoming DO message because the connection is invalid
hdiutil: create: returning 0
SLC1087-Matt:backups matt$ hdiutil attach ~/Desktop/SparseBundle.sparsebundle
Enter password to access "SparseBundle.sparsebundle":
hdiutil: attach failed - Authentication error
Alles scheint gut zu funktionieren, aber das Passwort ist offensichtlich falsch.
Was passiert, wenn Sie nur das Passwort ausdrucken? 'system (" echo $ passwort ")'? – Robert
Haben Sie verifiziert, dass dies tatsächlich in bash funktioniert? - d. h. ohne Perl. Einige Apps, auf die ich gestoßen bin, tun etwas, das mit Passwörtern funky ist und nichts mit diesem Format aufnimmt. Also öffne bash und führe einfach 'echo TheRealPassword | hdiutil create -size 200g -type SPARSEBUNDLE -cryption -stdinpass -volname \ "Verschlüsselter Speicher für Matt \" -fs \ "Groß- und Kleinschreibung Journaled HFS + \" -verbose ~/Desktop/SparseBundle' – GregHNZ
@GregHNZ, Warum? Das ist nicht das, was er mit Perl an die Shell weitergibt. – ikegami