<commit_before>#include <sys/stat.h>
#include <sys/wait.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <ioall.h>
#include "dvm2.h"

char *get_filename()
{
	char buf[DVM_FILENAME_SIZE];
	static char retname[sizeof(buf) + sizeof("/tmp/")];
	if (!read_all(0, buf, sizeof(buf)))
		exit(1);
	if (index(buf, '/')) {
		fprintf(stderr, "filename contains /");
		exit(1);
	}
	snprintf(retname, sizeof(retname), "/tmp/%s", buf);
	return retname;
}<commit_msg>vm/file-editor: mask some charracters in filename (#406)<commit_after>#include <sys/stat.h>
#include <sys/wait.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <ioall.h>
#include "dvm2.h"

char *get_filename()
{
	char buf[DVM_FILENAME_SIZE];
	static char retname[sizeof(buf) + sizeof("/tmp/")];
	int i;
	if (!read_all(0, buf, sizeof(buf)))
		exit(1);
	if (index(buf, '/')) {
		fprintf(stderr, "filename contains /");
		exit(1);
	}
	for (i=0; i < DVM_FILENAME_SIZE && buf[i]!=0; i++) {
		// replace some characters with _ (eg mimeopen have problems with some of them)
		if ((buf[i] > 0x20 && buf[i] < 0x30) || index(";:<=>?`~", buf[i]))
			buf[i]='_';
	}
	snprintf(retname, sizeof(retname), "/tmp/%s", buf);
	return retname;
}
{'fraction_non_alphanumeric': 0.21263482280431434, 'fraction_numerical': 0.014637904468412942, 'mean_word_length': 4.931506849315069, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1431819', 'n_tokens_mistral': 566, 'n_tokens_neox': 541, 'n_words': 120}