:
data=`cat << END_OF_LIST
x000000000000000000000000000000000000000000000000000000000000000
0x00000000000000000000000000000000000000000000000000000000000000
00x0000000000000000000000000000000000000000000000000000000000000
000x000000000000000000000000000000000000000000000000000000000000
0000x00000000000000000000000000000000000000000000000000000000000
00000x0000000000000000000000000000000000000000000000000000000000
000000x000000000000000000000000000000000000000000000000000000000
0000000x00000000000000000000000000000000000000000000000000000000
00000000x0000000000000000000000000000000000000000000000000000000
000000000x000000000000000000000000000000000000000000000000000000
0000000000x00000000000000000000000000000000000000000000000000000
00000000000x0000000000000000000000000000000000000000000000000000
000000000000x000000000000000000000000000000000000000000000000000
0000000000000x00000000000000000000000000000000000000000000000000
00000000000000x0000000000000000000000000000000000000000000000000
000000000000000x000000000000000000000000000000000000000000000000
0000000000000000x00000000000000000000000000000000000000000000000
00000000000000000x0000000000000000000000000000000000000000000000
000000000000000000x000000000000000000000000000000000000000000000
0000000000000000000x00000000000000000000000000000000000000000000
00000000000000000000x0000000000000000000000000000000000000000000
000000000000000000000x000000000000000000000000000000000000000000
0000000000000000000000x00000000000000000000000000000000000000000
00000000000000000000000x0000000000000000000000000000000000000000
000000000000000000000000x000000000000000000000000000000000000000
0000000000000000000000000x00000000000000000000000000000000000000
00000000000000000000000000x0000000000000000000000000000000000000
000000000000000000000000000x000000000000000000000000000000000000
0000000000000000000000000000x00000000000000000000000000000000000
00000000000000000000000000000x0000000000000000000000000000000000
000000000000000000000000000000x000000000000000000000000000000000
0000000000000000000000000000000x00000000000000000000000000000000
00000000000000000000000000000000x0000000000000000000000000000000
000000000000000000000000000000000x000000000000000000000000000000
0000000000000000000000000000000000x00000000000000000000000000000
00000000000000000000000000000000000x0000000000000000000000000000
000000000000000000000000000000000000x000000000000000000000000000
0000000000000000000000000000000000000x00000000000000000000000000
00000000000000000000000000000000000000x0000000000000000000000000
000000000000000000000000000000000000000x000000000000000000000000
0000000000000000000000000000000000000000x00000000000000000000000
00000000000000000000000000000000000000000x0000000000000000000000
000000000000000000000000000000000000000000x000000000000000000000
0000000000000000000000000000000000000000000x00000000000000000000
00000000000000000000000000000000000000000000x0000000000000000000
000000000000000000000000000000000000000000000x000000000000000000
0000000000000000000000000000000000000000000000x00000000000000000
00000000000000000000000000000000000000000000000x0000000000000000
000000000000000000000000000000000000000000000000x000000000000000
0000000000000000000000000000000000000000000000000x00000000000000
00000000000000000000000000000000000000000000000000x0000000000000
000000000000000000000000000000000000000000000000000x000000000000
0000000000000000000000000000000000000000000000000000x00000000000
00000000000000000000000000000000000000000000000000000x0000000000
000000000000000000000000000000000000000000000000000000x000000000
0000000000000000000000000000000000000000000000000000000x00000000
00000000000000000000000000000000000000000000000000000000x0000000
000000000000000000000000000000000000000000000000000000000x000000
0000000000000000000000000000000000000000000000000000000000x00000
00000000000000000000000000000000000000000000000000000000000x0000
000000000000000000000000000000000000000000000000000000000000x000
0000000000000000000000000000000000000000000000000000000000000x00
00000000000000000000000000000000000000000000000000000000000000x0
000000000000000000000000000000000000000000000000000000000000000x
END_OF_LIST`
exec 3> /tmp/APFS.log
exec 4> /tmp/ZFS.log
for i in 1 2 3 4 5 6 7 8 9 A B C D E F
do
echo "$data" | while read x
do
y=`echo $x | sed s/x/$i/g`
(
echo "================================================================================"
echo $y
echo "================================================================================"
set -x
xattr -wx com.apple.FinderInfo $y $a/Presentation1.pptx
xattr -l $a/Presentation1.pptx
) >&3 2>&1
(
echo "================================================================================"
echo $y
echo "================================================================================"
set -x
xattr -wx com.apple.FinderInfo $y $z/Presentation1.pptx
xattr -l $z/Presentation1.pptx
) >&4 2>&1
done
done
//! Structs and functions to manipulate MacOS/HFS+ structs, e.g. com.apple.FinderInfo.
//!
//! Note that HFS+ is big-endian, and so all serialization/deserialization has to be byteswapped
//! appropriately. APFS isn't big-endian, but it pretends pretty hard internally (and does so
//! here).
[features]
default = ["xattr"]
$ cargo build
$ cargo install --path .
$ xattr -c $a/Presentation1.pptx
$ xattr -l $a/Presentation1.pptx
$ ./finderinfo read $a/Presentation1.pptx
Attempting to read FinderInfo from "$a/Presentation1.pptx"
Err(
Os {
code: 93,
kind: Other,
message: "Attribute not found",
},
)
$ xattr -l $a/Presentation1.pptx
com.apple.FinderInfo:
00000000 00 00 00 00 00 00 00 00 00 0C 00 00 00 00 00 00 |................|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020
com.apple.metadata:_kMDItemUserTags:
00000000 62 70 6C 69 73 74 30 30 A1 01 55 52 65 64 0A 36 |bplist00..URed.6|
00000010 08 0A 00 00 00 00 00 00 01 01 00 00 00 00 00 00 |................|
00000020 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000030 00 10 |..|
00000032
$ ./finderinfo read $a/Presentation1.pptx
Attempting to read FinderInfo from "$a/Presentation1.pptx"
Ok(
File(
FinderInfoFile {
file_info: FileInfo {
fileType: Ok("\u{0}\u{0}\u{0}\u{0}"),
fileCreator: Ok("\u{0}\u{0}\u{0}\u{0}"),
finderFlags: FinderFlags {
raw: 12,
flags: [
"Red",
],
},
location: Point {
v: 0,
h: 0,
},
reservedField: 0,
},
extended_file_info: ExtendedFileInfo {
extendedFinderFlags: ExtendedFinderFlags {
raw: 0,
flags: [],
},
putAwayFolderID: 0,
},
},
),
)
$ xattr -c $z/Presentation1.pptx
$ xattr -l $z/Presentation1.pptx
$ ./finderinfo read $z/Presentation1.pptx
Attempting to read FinderInfo from "$z/Presentation1.pptx"
Err(
Os {
code: 93,
kind: Other,
message: "Attribute not found",
},
)
$ ./finderinfo read $z/Presentation1.pptx
Attempting to read FinderInfo from "$z/Presentation1.pptx"
Ok(
File(
FinderInfoFile {
file_info: FileInfo {
fileType: Ok("\u{0}\u{0}\u{0}\u{0}"),
fileCreator: Err(FromUtf8Error { bytes: [134, 255, 255, 255], error: Utf8Error { valid_up_to: 0, error_len: Some(1) } }),
finderFlags: FinderFlags {
raw: 14848,
flags: [
"kIsStationery",
"kNameLocked",
"kHasBundle",
],
},
location: Point {
v: 0,
h: 0,
},
reservedField: 0,
},
extended_file_info: ExtendedFileInfo {
reserved1: [
0,
0,
0,
0,
],
extendedFinderFlags: ExtendedFinderFlags {
raw: 32823,
flags: [
"kExtendedFlagsAreInvalid",
"kExtendedFlagHasCustomBadge",
],
},
reserved2: -1216,
putAwayFolderID: 0,
},
},
),
)
$ xattr -l $z/Presentation1.pptx
com.apple.metadata:_kMDItemUserTags:
00000000 62 70 6C 69 73 74 30 30 A1 01 55 52 65 64 0A 36 |bplist00..URed.6|
00000010 08 0A 00 00 00 00 00 00 01 01 00 00 00 00 00 00 |................|
00000020 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000030 00 10 |..|
00000032
com.apple.FinderInfo:
00000000 00 00 00 00 86 FF FF FF 3A 00 00 00 00 00 00 00 |........:.......|
00000010 00 00 00 00 00 00 00 00 80 37 FB 40 00 00 00 00 |.........7.@....|
00000020
:
data=`cat << END_OF_LIST
000000000000000000xy00000000000000000000000000000000000000000000
END_OF_LIST`
s=`date +%Y-%m-%d-%H%M%S`
exec 3> $HOME/tmp/APFS-$s.log
exec 4> $HOME/tmp/ZFS-$s.log
for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F
do
for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F
do
echo "$data" | while read p
do
p=`echo $p | sed s/x/$i/g`
p=`echo $p | sed s/y/$j/g`
(
echo "================================================================================"
echo $p
echo "================================================================================"
set -x
xattr -wx com.apple.FinderInfo $p $a/Presentation1.pptx
xattr -vpx com.apple.FinderInfo $a/Presentation1.pptx
finderinfo read $a/Presentation1.pptx
) >&3 2>&1
(
echo "================================================================================"
echo $p
echo "================================================================================"
set -x
xattr -wx com.apple.FinderInfo $p $z/Presentation1.pptx
xattr -vpx com.apple.FinderInfo $z/Presentation1.pptx
finderinfo read $z/Presentation1.pptx
) >&4 2>&1
done
done
done
================================================================================
0000000000000000000200000000000000000000000000000000000000000000
================================================================================
++ xattr -wx com.apple.FinderInfo 0000000000000000000200000000000000000000000000000000000000000000 $a/Presentation1.pptx
++ xattr -vpx com.apple.FinderInfo $a/Presentation1.pptx
$a/Presentation1.pptx:
00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
++ finderinfo read $a/Presentation1.pptx
Attempting to read FinderInfo from "$a/Presentation1.pptx"
Ok(
File(
FinderInfoFile {
file_info: FileInfo {
fileType: Ok("\u{0}\u{0}\u{0}\u{0}"),
fileCreator: Ok("\u{0}\u{0}\u{0}\u{0}"),
finderFlags: FinderFlags {
raw: 2,
flags: [
"Gray",
],
},
location: Point {
v: 0,
h: 0,
},
reservedField: 0,
},
extended_file_info: ExtendedFileInfo {
extendedFinderFlags: ExtendedFinderFlags {
raw: 0,
flags: [],
},
putAwayFolderID: 0,
},
},
),
)
================================================================================
0000000000000000000200000000000000000000000000000000000000000000
================================================================================
++ xattr -wx com.apple.FinderInfo 0000000000000000000200000000000000000000000000000000000000000000 $z/Presentation1.pptx
++ xattr -vpx com.apple.FinderInfo $z/Presentation1.pptx
xattr: $z/Presentation1.pptx: No such xattr: com.apple.FinderInfo
$z/Presentation1.pptx:
++ finderinfo read $z/Presentation1.pptx
Attempting to read FinderInfo from "$z/Presentation1.pptx"
Err(
Os {
code: 93,
kind: Other,
message: "Attribute not found",
},
)
Users browsing this forum: Baidu [Spider] and 26 guests