Skip to content

Instantly share code, notes, and snippets.

@lewurm
Last active June 20, 2017 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lewurm/f7170d481c1f5f14a0c1294be058020b to your computer and use it in GitHub Desktop.
Save lewurm/f7170d481c1f5f14a0c1294be058020b to your computer and use it in GitHub Desktop.
% cat ~/delete.cs
using System.IO;
public class DeleteMe {
public static void Main (string []args) {
File.Delete ("lolwoot.tmp");
}
}
% dd if=/dev/zero of=file.img count=102400
102400+0 records in
102400+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.109139 s, 480 MB/s
% sudo mkdir /mnt/file
[sudo] password for lewurm:
% fdisk file.img
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xf2050179.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-102399, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-102399, default 102399):
Created a new partition 1 of type 'Linux' and of size 49 MiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
% mkfs.ext4 file.img
mke2fs 1.42.13 (17-May-2015)
Found a dos partition table in file.img
Proceed anyway? (y,n) y
Discarding device blocks: done
Creating filesystem with 51200 1k blocks and 12824 inodes
Filesystem UUID: 5550c491-7958-460d-8bf9-70d6dc3c11a2
Superblock backups stored on blocks:
8193, 24577, 40961
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
% cd /mnt/file
% touch heyllo
touch: cannot touch 'heyllo': Read-only file system
% ~/work/mono/b/bin/mono-sgen ~/delete.exe
Unhandled Exception:
System.UnauthorizedAccessException: Access to the path "lolwoot.tmp" is denied.
at System.IO.File.Delete (System.String path) [0x00073] in <a751531b06a2476590f0d6f9ce269ffd>:0
at DeleteMe.Main (System.String[] args) [0x00000] in <89772c1eeda1439c98837eab082fc0d6>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.UnauthorizedAccessException: Access to the path "lolwoot.tmp" is denied.
at System.IO.File.Delete (System.String path) [0x00073] in <a751531b06a2476590f0d6f9ce269ffd>:0
at DeleteMe.Main (System.String[] args) [0x00000] in <89772c1eeda1439c98837eab082fc0d6>:0
% ~/work/mono/b/bin/mono-sgen --version
Mono JIT compiler version 5.5.0 (master/26cad09 Mon Jun 19 13:37:25 PDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen (concurrent by default)
% ~/work/mono-4.8.0/bin/mono-sgen ~/delete.exe
bernhard-linux-vbox /mnt/file
% ~/work/mono-4.8.0/bin/mono-sgen --version
Mono JIT compiler version 4.8.1 (mono-4.8.0-branch/22a39d7 Tue Jun 20 03:23:25 PDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment