[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] OpenBSD madness...
From: |
Milan Cvetkovic |
Subject: |
Re: [Gnu-arch-users] OpenBSD madness... |
Date: |
Wed, 28 Jun 2006 17:13:46 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060503 Debian/1.7.8-1sarge6 |
Alfred M. Szmidt wrote:
> Hey,
>
> This fixes a bunch of silly problems on OpenBSD 3.6, their version of
> GCC doesn't like code that looks like:
>
> {
> int foo;
> foo = 0;
> int bar;
> }
These are not silly. This was not a valid "C" last time I checked.
Milan.
>
> Which this patch fixes. The only reason why libarch/cmd-export.c is
> so big is because the file didn't follow any coding standard known to
> man. Running `indent' on every file is probobly a good idea! :-)
>
> Andy, if you want a cleaner version of this, please give me a shout if
> you want one. And I'm sorry for not providing an arch archive for
> this, but I don't have access to such luxuries today.
>
> Cheers.
>
> * looking for address@hidden/tla--atai--1.3--patch-67 to compare with
> * comparing to address@hidden/tla--atai--1.3--patch-67
> M libarch/cmd-diff.c
> M libarch/cmd-commit.c
> M libarch/star-merge.c
> M libarch/changeset-report.c
> M libarch/cmd-export.c
>
> * modified files
>
> --- orig/libarch/changeset-report.c
> +++ mod/libarch/changeset-report.c
> @@ -615,18 +615,23 @@
> safe_printfmt ( out_fd, "* modified files\n\n");
> for (x = 0; x < rel_n_records (report->patched_regular_files); ++x)
> {
> - t_uchar * id = str_save(0,
> rel_peek_str(report->patched_regular_files, x, 1))
> /*report->patched_regular_files[x][1]*/;
> - t_uchar * id2 = str_save(0,
> rel_peek_str(report->patched_regular_files, x, 0))
> /*report->patched_regular_files[x][1]*/;
> + t_uchar *id = str_save(0,
> rel_peek_str(report->patched_regular_files, x, 1))
> /*report->patched_regular_files[x][1]*/;
> + t_uchar *id2 = str_save(0,
> rel_peek_str(report->patched_regular_files, x, 0))
> /*report->patched_regular_files[x][1]*/;
> +
> + t_uchar *orig_part_path;
> + t_uchar *orig_path;
> + t_uchar *mod_path;
> +
> key = rel_make_field_str(id);
>
> rel_field_ref(key);
>
> - t_uchar * orig_part_path = assoc_get_str_taking(orig_paths, key)
> /*assoc_ref(orig_paths, id)*/;
> - t_uchar * orig_path = file_name_in_vicinity(0, orig_dir,
> orig_part_path);
> - t_uchar * mod_path = file_name_in_vicinity(0, mod_dir, id2
> /*report->patched_regular_files[x][0]*/);
> -
> - arch_really_invoke_diff ( out_fd, orig_path, orig_part_path,
> mod_path, id2 /*report->patched_regular_files[x][0]*/, (char **)opts);
> -
> + orig_part_path = assoc_get_str_taking(orig_paths, key)
> /*assoc_ref(orig_paths, id)*/;
> + orig_path = file_name_in_vicinity(0, orig_dir, orig_part_path);
> + mod_path = file_name_in_vicinity(0, mod_dir, id2
> /*report->patched_regular_files[x][0]*/);
> +
> + arch_really_invoke_diff ( out_fd, orig_path, orig_part_path,
> mod_path, id2 /*report->patched_regular_files[x][0]*/, (char **)opts);
> +
> rel_field_unref(key);
> lim_free(0, mod_path);
> lim_free(0, orig_path);
>
>
> --- orig/libarch/cmd-commit.c
> +++ mod/libarch/cmd-commit.c
> @@ -110,6 +110,7 @@
> t_uchar *file_name = 0;
> t_uchar *content_spec = 0;
> t_uchar *s = str_chr_index(revision_file_spec, ':');
> + int fd ;
>
> if (!s)
> {
> @@ -119,7 +120,7 @@
> }
> file_name = str_save_n(0, revision_file_spec, s - revision_file_spec);
>
> - int fd ;
> +
> fd = safe_open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666);
> if (!fd)
> {
>
>
> --- orig/libarch/cmd-diff.c
> +++ mod/libarch/cmd-diff.c
> @@ -134,8 +134,9 @@
> int escape_classes = arch_escape_classes;
> int latest = 0;
> int files_specified = 0;
> + rel_table exclude_list;
> dir = str_save (0, ".");
> - rel_table exclude_list = rel_table_nil;
> + exclude_list = rel_table_nil;
>
> safe_buffer_fd (1, 0, O_WRONLY, 0);
>
>
>
> --- orig/libarch/cmd-export.c
> +++ mod/libarch/cmd-export.c
> @@ -189,11 +189,11 @@
> int silent = 0;
> int revision_from_working_tree = 0;
> dir = str_save (0, ".");
> -
> +
> safe_buffer_fd (1, 0, O_WRONLY, 0);
> -
> +
> option = 0;
> -
> +
> while (1)
> {
> o = opt_standard (lim_use_must_malloc, &option, opts, &argc, argv,
> program_name, usage, version_string, arch_cmd_export_help, opt_help_msg,
> opt_long_help, opt_version);
> @@ -210,15 +210,15 @@
> default:
> safe_printfmt (2, "unhandled option `%s'\n", option->opt_string);
> panic ("internal error parsing arguments");
> -
> +
> usage_error:
> opt_usage (2, argv[0], program_name, usage, 1);
> exit (1);
> -
> +
> /* bogus_arg: */
> safe_printfmt (2, "ill-formed argument for `%s' (`%s')\n",
> option->opt_string, option->arg_string);
> goto usage_error;
> -
> +
> case opt_silent:
> {
> silent = 1;
> @@ -226,10 +226,10 @@
> }
> }
> }
> -
> +
> if ((argc < 2) || (argc > 3))
> goto usage_error;
> -
> +
> {
> int here_fd;
> int tmp_dir_is_local_cache = 0;
> @@ -248,41 +248,39 @@
> {
> output_dir = str_save(0, argv[1]);
> tree_root = arch_tree_root(0, dir, 0);
> - if (tree_root)
> - {
> -
> - revision_spec = arch_get_tree_fqrevision(tree_root);
> - revision_from_working_tree = 1;
> + if (tree_root)
> + {
> + revision_spec = arch_get_tree_fqrevision(tree_root);
> + revision_from_working_tree = 1;
> }
> else
> {
> - safe_printfmt (2, _("Cannot determine revision of directory
> %s\n"), dir);
> - exit (2);
> + safe_printfmt (2, _("Cannot determine revision of directory %s\n"),
> dir);
> + exit (2);
> }
> - }
> -
> + }
> else if (argc == 3)
> {
> output_dir = str_save(0, argv[2]);
> revision_spec = arch_get_fqrevision(argv[1]);
> }
> -
> -
> +
> +
> here_fd = safe_open (".", O_RDONLY, 0);
> -
> +
> last_arg = str_save (0, argv[1]);
> tree_arch = arch_parse_package_name (arch_ret_archive, 0, revision_spec);
> if (tree_arch)
> - arch = arch_archive_connect(tree_arch, 0);
> -
> - if (!tree_arch || !arch)
> - {
> - safe_printfmt (2, _("Cannot connect to archive for revision %s\n"),
> revision_spec);
> - exit (2);
> - }
> -
> -
> + arch = arch_archive_connect(tree_arch, 0);
> +
> + if (!tree_arch || !arch)
> + {
> + safe_printfmt (2, _("Cannot connect to archive for revision %s\n"),
> revision_spec);
> + exit (2);
> + }
> +
> invariant (!!arch);
> +
> revision = arch_parse_package_name (arch_ret_non_archive, NULL,
> revision_spec);
>
> if (!output_dir)
> @@ -292,109 +290,105 @@
> output_dir = file_name_in_vicinity (0, cwd, revision);
> lim_free (0, cwd);
> }
> -
> +
> invariant (!!output_dir);
> +
> + {
> + t_uchar * canonical_dir = 0;
> + t_uchar * output_dirname = 0;
> + t_uchar * cwd = safe_current_working_directory ();
> + t_uchar * absolute_output_dir = 0;
> + int output_dirname_exists;
> + if (file_name_is_absolute(output_dir))
> + absolute_output_dir = str_save(0, output_dir);
> + else
> + absolute_output_dir = str_alloc_cat_many(0, cwd, "/", output_dir,
> str_end);
> + canonical_dir = file_name_from_directory(0, absolute_output_dir);
> + output_dirname = file_name_directory (0, canonical_dir);
>
> - {
> + output_dirname_exists = safe_access (output_dirname, F_OK) == 0;
> +
> + if (!output_dirname_exists)
> + {
> + safe_printfmt (2, _("Parent dir of output directory, %s, does not
> exist\n"), output_dirname);
> + exit (2);
> + }
> + lim_free(0, canonical_dir);
> + lim_free(0, output_dirname);
> + lim_free(0, cwd);
> + lim_free(0, absolute_output_dir);
> +
> + }
>
> - t_uchar * canonical_dir = 0;
> - t_uchar * output_dirname = 0;
> - t_uchar * cwd = safe_current_working_directory ();
> - t_uchar * absolute_output_dir = 0;
> - if (file_name_is_absolute(output_dir))
> - absolute_output_dir = str_save(0, output_dir);
> -
> - else
> - absolute_output_dir = str_alloc_cat_many(0, cwd, "/", output_dir,
> str_end);
> - canonical_dir = file_name_from_directory(0, absolute_output_dir);
> - output_dirname = file_name_directory (0, canonical_dir);
> -
> - int output_dirname_exists = safe_access (output_dirname, F_OK) == 0;
> -
> - if (!output_dirname_exists)
> - {
> - safe_printfmt (2, _("Parent dir of output directory, %s, does
> not exist\n"), output_dirname);
> - exit (2);
> - }
> - lim_free(0, canonical_dir);
> - lim_free(0, output_dirname);
> - lim_free(0, cwd);
> - lim_free(0, absolute_output_dir);
> -
> - }
> -
> if (!safe_access (output_dir, F_OK))
> {
> safe_printfmt (2, "%s: output directory already exists (%s)\n",
> argv[0], output_dir);
> exit (1);
> }
> -
>
> -
> {
> - t_uchar * revision_dir = 0;
> - t_uchar * tmp_tree_root = 0;
> - rel_table index = rel_table_nil;
> - rel_table index_stripped = rel_table_nil;
> - rel_table index_subdird = rel_table_nil;
> -
> - /* FIXME: inefficient, since arch_build_revision is already
> - * doing an inventory and throwing it away.
> - */
> - if (revision_from_working_tree)
> - {
> - arch_chatter (1, "* trying to build pristine export from local
> cache\n");
> - tmp_dir = arch_find_or_make_local_copy ((silent ? -1 : 1),
> tree_root, dir, arch, tree_arch, revision);
> - if (tmp_dir)
> + t_uchar * revision_dir = 0;
> + t_uchar * tmp_tree_root = 0;
> + rel_table index = rel_table_nil;
> + rel_table index_stripped = rel_table_nil;
> + rel_table index_subdird = rel_table_nil;
> +
> + /* FIXME: inefficient, since arch_build_revision is already
> + * doing an inventory and throwing it away.
> + */
> + if (revision_from_working_tree)
> + {
> + arch_chatter (1, "* trying to build pristine export from local
> cache\n");
> + tmp_dir = arch_find_or_make_local_copy ((silent ? -1 : 1), tree_root,
> dir, arch, tree_arch, revision);
> + if (tmp_dir)
> tmp_dir_is_local_cache = 1;
> - }
> - if (!tmp_dir)
> - {
> - tmp_dir = tmp_file_name_in_tmp ("export");
> - rmrf_file (tmp_dir);
> - safe_mkdir (tmp_dir, 0777);
> - arch_build_revision ((silent ? -1 : 1), tmp_dir, arch, tree_arch,
> revision, NULL);
> - }
> - tmp_tree_root = arch_tree_root(0, tmp_dir, 0);
> - index = arch_source_inventory (tmp_tree_root, 1, 0, 0);
> - safe_flush (1);
> - index_stripped = arch_filter_control_files (index);
> - if (subdir)
> - {
> - safe_printfmt(2," limiting to %s", subdir);
> - index_subdird = arch_filter_to_subdir (index_stripped,
> str_alloc_cat(0, "./", subdir));
> - }
> - else
> - {
> - index_subdird = index_stripped;
> - }
> - rel_sort_table_by_field (0, index_subdird, 0);
> - arch_chatter (1, "* building clean tree in %s\n", output_dir);
> - copy_file_list (output_dir, tmp_dir, index_subdird, 1);
> -
> - lim_free (0, revision_dir);
> - lim_free(0, tmp_tree_root);
> -
> + }
> + if (!tmp_dir)
> + {
> + tmp_dir = tmp_file_name_in_tmp ("export");
> + rmrf_file (tmp_dir);
> + safe_mkdir (tmp_dir, 0777);
> + arch_build_revision ((silent ? -1 : 1), tmp_dir, arch, tree_arch,
> revision, NULL);
> + }
> + tmp_tree_root = arch_tree_root(0, tmp_dir, 0);
> + index = arch_source_inventory (tmp_tree_root, 1, 0, 0);
> + safe_flush (1);
> + index_stripped = arch_filter_control_files (index);
> + if (subdir)
> + {
> + safe_printfmt(2," limiting to %s", subdir);
> + index_subdird = arch_filter_to_subdir (index_stripped,
> str_alloc_cat(0, "./", subdir));
> + }
> + else
> + {
> + index_subdird = index_stripped;
> + }
> + rel_sort_table_by_field (0, index_subdird, 0);
> + arch_chatter (1, "* building clean tree in %s\n", output_dir);
> + copy_file_list (output_dir, tmp_dir, index_subdird, 1);
> +
> + lim_free (0, revision_dir);
> + lim_free(0, tmp_tree_root);
> }
> -
> +
> arch_archive_close (arch);
> -
> +
> safe_fchdir (here_fd);
> safe_close (here_fd);
> if (tmp_dir_is_local_cache == 0)
> - rmrf_file (tmp_dir);
> -
> + rmrf_file (tmp_dir);
> +
> lim_free (0, revision_spec);
> lim_free (0, revision);
> lim_free (0, output_dir);
> lim_free (0, tmp_dir);
> lim_free (0, tree_root);
> }
> -
> +
> lim_free (0, selected_library);
> lim_free (0, cache_dir_spec);
> -
> +
> return 0;
> }
>
>
>
> --- orig/libarch/star-merge.c
> +++ mod/libarch/star-merge.c
> @@ -296,6 +296,9 @@
> struct arch_make_changeset_report make_report = {0, };
> struct arch_apply_changeset_report apply_report = {0, };
>
> + assoc_table older_files_table;
> + assoc_table yours_files_table;
> +
> t_uchar * tmp_dir = tmp_file_name (mine_tree_root, ",,star-merge");
> t_uchar * changeset = file_name_in_vicinity (0, tmp_dir, ",,changeset");
> assoc_table inode_shortcut = 0;
> @@ -312,8 +315,8 @@
> apply_report.callback = star_merge_callback;
> apply_report.thunk = (void *)(long)chatter_fd;
> }
> - assoc_table older_files_table = tag_index_to_full_paths (base_tree_root);
> - assoc_table yours_files_table = tag_index_to_full_paths (other_tree_root);
> + older_files_table = tag_index_to_full_paths (base_tree_root);
> + yours_files_table = tag_index_to_full_paths (other_tree_root);
>
> arch_read_inode_sig (0, &inode_shortcut, base_tree_root, other_tree_root,
> base_revision);
>
>
>
> _______________________________________________
> Gnu-arch-users mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnu-arch-users
>
> GNU arch home page:
> http://savannah.gnu.org/projects/gnu-arch/
>
- [Gnu-arch-users] OpenBSD madness..., Alfred M. Szmidt, 2006/06/28
- Re: [Gnu-arch-users] OpenBSD madness...,
Milan Cvetkovic <=
- Re: [Gnu-arch-users] OpenBSD madness..., Alfred M. Szmidt, 2006/06/28
- Re: [Gnu-arch-users] OpenBSD madness..., Alfred M. Szmidt, 2006/06/28
- Re: [Gnu-arch-users] OpenBSD madness..., Thomas Lord, 2006/06/28
- Re: [Gnu-arch-users] OpenBSD madness..., Mark Flacy, 2006/06/28
- Re: [Gnu-arch-users] OpenBSD madness..., Thomas Lord, 2006/06/28
- Re: [Gnu-arch-users] OpenBSD madness..., Alfred M. Szmidt, 2006/06/28
- [Gnu-arch-users] Re: OpenBSD madness..., Miles Bader, 2006/06/28