Mageia Bugzilla – Attachment 7003 Details for
Bug 16455
xfsprogs new security issue CVE-2012-2150
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
xfsprogs test script
xfsprogs-test.sh (text/plain), 2.84 KB, created by
Yann Cantin
on 2015-09-12 17:48:19 CEST
(
hide
)
Description:
xfsprogs test script
Filename:
MIME Type:
Creator:
Yann Cantin
Created:
2015-09-12 17:48:19 CEST
Size:
2.84 KB
patch
obsolete
>#!/bin/bash ># xfsprogs-test.sh > ># Adapted from Squashfs-compression-test.sh ># https://fedoraproject.org/wiki/QA:Testcase_squashfs-tools_compression > ># Define block sizes >blocks=(4K 1M) > ># Define fill files >fill=(/dev/zero /dev/urandom) > ># Define number of iterations >iter=5 > ># Define fragment sizes >frags=(0 1 2047 4095) > ># Define test directory >testdir=./test-fs > ># Define fs img file >img=${testdir}/fs.img > ># Define mount point >mp=${testdir}/mnt > ># Define data directory >datadir=${testdir}/data > ># Check for uid 0 and print a warning if not >[ ${UID} -ne 0 ] && { echo 'This script must be run as root.'; exit 1; } > ># Check if test directory exists and make if not >[ -d ${testdir} ] || mkdir ${testdir} >[ -d ${testdir} ] || { echo "Unable to make '${testdir}', aborting."; exit 1; } > ># Check if mount point directory exists and make if not >[ -d ${mp} ] || mkdir ${mp} >[ -d ${mp} ] || { echo "Unable to make '${mp}', aborting."; exit 1; } > ># Check if data directory exists and make if not >if [ -d ${datadir} ]; then > echo "Using existing data directory." >else > echo "Building data directory (approx 300Mo)." > mkdir ${datadir} > [ -d ${datadir} ] || { echo "Unable to make '${datadir}', aborting."; exit 1; } > mkdir ${datadir}/frags > [ -d ${datadir}/frags ] || { echo "Unable to make '${datadir}/frags', aborting."; exit 1; } > for size in ${frags[*]}; do > for file in ${fill[*]}; do > dd if=${file} of=${datadir}/frags/frag-`basename ${file}`-${size} bs=1 count=${size} > /dev/null 2>&1 > done > done > mkdir ${datadir}/blocks > [ -d ${datadir}/blocks ] || { echo "Unable to make '${datadir}/blocks', aborting."; exit 1; } > for size in ${blocks[*]}; do > for ((count=1;${count}<=${iter};count++)); do > for file in ${fill[*]}; do > dd if=${file} of=${datadir}/blocks/file-`basename ${file}`-${size}-${count} bs=${size} count=${count} > /dev/null 2>&1 > done > done > done > mkdir ${datadir}/combo > [ -d ${datadir}/combo ] || { echo "Unable to make '${datadir}/combo', aborting."; exit 1; } > for size1 in ${frags[*]}; do > for file1 in ${fill[*]}; do > for size2 in ${blocks[*]}; do > for ((count=1;${count}<=${iter};count++)); do > for file2 in ${fill[*]}; do > cat ${datadir}/blocks/file-`basename ${file2}`-${size2}-${count} ${datadir}/frags/frag-`basename ${file1}`-${size1} > ${datadir}/combo/combined-`basename ${file2}`-${size2}-${count}-`basename ${file1}`-${size1} > done > done > done > done > done >fi > ># Create clean img file >[ -e ${img} ] && rm -f ${img} >mkfs.xfs -d file=1,name=${img},size=500m >[ -e ${img} ] || { echo "mkfs.xfs failed."; exit 1; } > ># Mount >mount -o loop ${img} ${mp} || { echo "Mount failed."; exit 1; } > ># Write >cp -pr ${datadir}/* ${mp} || { echo "Copying failed."; exit 1; } > >diff -r -q ${mp} ${datadir} || { echo "Test failed." ; umount ${mp} ; exit 1; } > >umount ${mp} >echo "Test OK."
#!/bin/bash # xfsprogs-test.sh # Adapted from Squashfs-compression-test.sh # https://fedoraproject.org/wiki/QA:Testcase_squashfs-tools_compression # Define block sizes blocks=(4K 1M) # Define fill files fill=(/dev/zero /dev/urandom) # Define number of iterations iter=5 # Define fragment sizes frags=(0 1 2047 4095) # Define test directory testdir=./test-fs # Define fs img file img=${testdir}/fs.img # Define mount point mp=${testdir}/mnt # Define data directory datadir=${testdir}/data # Check for uid 0 and print a warning if not [ ${UID} -ne 0 ] && { echo 'This script must be run as root.'; exit 1; } # Check if test directory exists and make if not [ -d ${testdir} ] || mkdir ${testdir} [ -d ${testdir} ] || { echo "Unable to make '${testdir}', aborting."; exit 1; } # Check if mount point directory exists and make if not [ -d ${mp} ] || mkdir ${mp} [ -d ${mp} ] || { echo "Unable to make '${mp}', aborting."; exit 1; } # Check if data directory exists and make if not if [ -d ${datadir} ]; then echo "Using existing data directory." else echo "Building data directory (approx 300Mo)." mkdir ${datadir} [ -d ${datadir} ] || { echo "Unable to make '${datadir}', aborting."; exit 1; } mkdir ${datadir}/frags [ -d ${datadir}/frags ] || { echo "Unable to make '${datadir}/frags', aborting."; exit 1; } for size in ${frags[*]}; do for file in ${fill[*]}; do dd if=${file} of=${datadir}/frags/frag-`basename ${file}`-${size} bs=1 count=${size} > /dev/null 2>&1 done done mkdir ${datadir}/blocks [ -d ${datadir}/blocks ] || { echo "Unable to make '${datadir}/blocks', aborting."; exit 1; } for size in ${blocks[*]}; do for ((count=1;${count}<=${iter};count++)); do for file in ${fill[*]}; do dd if=${file} of=${datadir}/blocks/file-`basename ${file}`-${size}-${count} bs=${size} count=${count} > /dev/null 2>&1 done done done mkdir ${datadir}/combo [ -d ${datadir}/combo ] || { echo "Unable to make '${datadir}/combo', aborting."; exit 1; } for size1 in ${frags[*]}; do for file1 in ${fill[*]}; do for size2 in ${blocks[*]}; do for ((count=1;${count}<=${iter};count++)); do for file2 in ${fill[*]}; do cat ${datadir}/blocks/file-`basename ${file2}`-${size2}-${count} ${datadir}/frags/frag-`basename ${file1}`-${size1} > ${datadir}/combo/combined-`basename ${file2}`-${size2}-${count}-`basename ${file1}`-${size1} done done done done done fi # Create clean img file [ -e ${img} ] && rm -f ${img} mkfs.xfs -d file=1,name=${img},size=500m [ -e ${img} ] || { echo "mkfs.xfs failed."; exit 1; } # Mount mount -o loop ${img} ${mp} || { echo "Mount failed."; exit 1; } # Write cp -pr ${datadir}/* ${mp} || { echo "Copying failed."; exit 1; } diff -r -q ${mp} ${datadir} || { echo "Test failed." ; umount ${mp} ; exit 1; } umount ${mp} echo "Test OK."
View Attachment As Raw
Actions:
View
Attachments on
bug 16455
: 7003