Hello community, here is the log from the commit of package editorconfig-core-c for openSUSE:Factory checked in at 2018-05-22 16:58:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/editorconfig-core-c (Old) and /work/SRC/openSUSE:Factory/.editorconfig-core-c.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "editorconfig-core-c" Tue May 22 16:58:34 2018 rev:5 rq:610278 version:0.12.2 Changes: -------- --- /work/SRC/openSUSE:Factory/editorconfig-core-c/editorconfig-core-c.changes 2017-08-24 18:26:07.467478365 +0200 +++ /work/SRC/openSUSE:Factory/.editorconfig-core-c.new/editorconfig-core-c.changes 2018-05-22 16:58:35.879570248 +0200 @@ -1,0 +2,8 @@ +Fri May 18 11:14:25 UTC 2018 - astie...@suse.com + +- update to 0.12.2: + * Add support for pkgconfig + * Memory leaks and crash fixes + * Improve error messages + +------------------------------------------------------------------- Old: ---- editorconfig-core-c-0.12.1.tar.gz New: ---- editorconfig-core-c-0.12.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ editorconfig-core-c.spec ++++++ --- /var/tmp/diff_new_pack.uIWmMm/_old 2018-05-22 16:58:36.515547108 +0200 +++ /var/tmp/diff_new_pack.uIWmMm/_new 2018-05-22 16:58:36.519546963 +0200 @@ -1,7 +1,7 @@ # # spec file for package editorconfig-core-c # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,10 +17,10 @@ Name: editorconfig-core-c -Version: 0.12.1 +Version: 0.12.2 Release: 0 Summary: EditorConfig core library written in C -License: BSD-2-Clause and BSD-3-Clause +License: BSD-2-Clause AND BSD-3-Clause Group: Development/Libraries/C and C++ Url: http://editorconfig.org/ Source: https://github.com/editorconfig/editorconfig-core-c/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz @@ -30,7 +30,6 @@ BuildRequires: cmake >= 2.8.7 BuildRequires: doxygen BuildRequires: pcre-devel >= 0.12.0 -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description EditorConfig makes it easy to maintain the correct coding style when switching @@ -100,23 +99,22 @@ %postun -n libeditorconfig0 -p /sbin/ldconfig %files -n editorconfig -%defattr(-,root,root) -%doc LICENSE +%license LICENSE %{_bindir}/editorconfig* %{_mandir}/man1/editorconfig* %{_mandir}/man5/editorconfig* %files -n libeditorconfig0 -%defattr(-,root,root) -%doc LICENSE +%license LICENSE %{_libdir}/libeditorconfig.so.0* %files -n libeditorconfig-devel -%defattr(-,root,root) -%doc CONTRIBUTORS LICENSE README.md +%license LICENSE +%doc CONTRIBUTORS README.md %{_docdir}/libeditorconfig-devel %{_includedir}/editorconfig %{_libdir}/libeditorconfig.so %{_mandir}/man3/editorconfig* +%{_libdir}/pkgconfig/editorconfig.pc %changelog ++++++ editorconfig-core-c-0.12.1-install_paths.patch ++++++ --- /var/tmp/diff_new_pack.uIWmMm/_old 2018-05-22 16:58:36.571545071 +0200 +++ /var/tmp/diff_new_pack.uIWmMm/_new 2018-05-22 16:58:36.571545071 +0200 @@ -4,16 +4,16 @@ Adjust the install paths Move HTML docs to devel package -Index: editorconfig-core-c-0.12.1/doc/CMakeLists.txt +Index: editorconfig-core-c-0.12.2/doc/CMakeLists.txt =================================================================== ---- editorconfig-core-c-0.12.1.orig/doc/CMakeLists.txt -+++ editorconfig-core-c-0.12.1/doc/CMakeLists.txt +--- editorconfig-core-c-0.12.2.orig/doc/CMakeLists.txt ++++ editorconfig-core-c-0.12.2/doc/CMakeLists.txt @@ -125,7 +125,7 @@ if(BUILD_DOCUMENTATION) if(INSTALL_HTML_DOC) install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" -- DESTINATION share/doc/editorconfig) -+ DESTINATION share/doc/packages/libeditorconfig-devel) +- DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/editorconfig") ++ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/packages/libeditorconfig-devel") endif(INSTALL_HTML_DOC) else(DOXYGEN_FOUND) ++++++ editorconfig-core-c-0.12.1.tar.gz -> editorconfig-core-c-0.12.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/.gitignore new/editorconfig-core-c-0.12.2/.gitignore --- old/editorconfig-core-c-0.12.1/.gitignore 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/.gitignore 2018-03-15 22:02:13.000000000 +0100 @@ -28,3 +28,6 @@ # Generated by `make` /bin /lib + +# Eclipse +.project diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/CMakeLists.txt new/editorconfig-core-c-0.12.2/CMakeLists.txt --- old/editorconfig-core-c-0.12.1/CMakeLists.txt 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/CMakeLists.txt 2018-03-15 22:02:13.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2016 EditorConfig Team +# Copyright (c) 2011-2018 EditorConfig Team # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -29,12 +29,13 @@ set (editorconfig_VERSION_MAJOR 0) set (editorconfig_VERSION_MINOR 12) -set (editorconfig_VERSION_PATCH 1) +set (editorconfig_VERSION_PATCH 2) set (editorconfig_VERSION_SUFFIX "") project(editorconfig C) +include(GNUInstallDirs) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake_Modules") # set default compilation directory diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/INSTALL.md new/editorconfig-core-c-0.12.2/INSTALL.md --- old/editorconfig-core-c-0.12.1/INSTALL.md 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/INSTALL.md 2018-03-15 22:02:13.000000000 +0100 @@ -12,7 +12,7 @@ Debian (Jessie and later): `apt-get install editorconfig` -ArchLinux: An [Arch AUR package](https://aur.archlinux.org/packages/editorconfig-core-c) is available. +ArchLinux: `pacman -S editorconfig-core-c` Mac OS X users can `brew install editorconfig` with [Homebrew](http://brew.sh). Generally Linux users can also install with [LinuxBrew](https://github.com/Homebrew/linuxbrew) @@ -28,8 +28,12 @@ - Homebrew on OS X: `brew install cmake pcre` - Ubuntu/Debian: `apt-get install cmake libpcre3-dev` -Make sure cmake is in your PATH environment variable. Switch to the root -directory of editorconfig and execute the following command: +Make sure cmake is in your PATH environment variable. on Windows, you also need +to build pcre from source. If you want to build the MT version of this library, +after running `cmake .` in the pcre source directory, please replace all +occurrence of "MD" with "MT" in the CMakeCache.txt. + +Switch to the root directory of editorconfig and execute the following command: cmake . @@ -43,7 +47,9 @@ -DBUILD_STATICALLY_LINKED_EXE=[ON|OFF] Default: OFF If this option is on, the executable will be linked statically to all - libraries. This option is currently only valid for gcc. + libraries. On MSVC, this means that EditorConfig will be statically + linked to the executable. On GCC, this means all libraries (glibc and + EditorConfig) are statically linked to the executable. e.g. cmake -DBUILD_STATICALLY_LINKED_EXE=ON . -DINSTALL_HTML_DOC=[ON|OFF] Default: OFF @@ -59,7 +65,7 @@ -DMSVC_MD=[ON|OFF] Default: OFF Use /MD instead of /MT flag when compiling with Microsoft Visual C++. This option takes no effect when using compilers other than Microsoft Visual - C++. + C++. Note that the option chosen here must be consistent with pcre. e.g. We want to use /MD instead of /MT when compiling with MSVC. cmake -DMSVC_MD=ON . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/README.md new/editorconfig-core-c-0.12.2/README.md --- old/editorconfig-core-c-0.12.1/README.md 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/README.md 2018-03-15 22:02:13.000000000 +0100 @@ -2,6 +2,7 @@ ================ [![Build Status](https://secure.travis-ci.org/editorconfig/editorconfig-core-c.svg?branch=master)](http://travis-ci.org/editorconfig/editorconfig-core-c) +[![Build status](https://ci.appveyor.com/api/projects/status/u9t8m4uech5kejoi/branch/master?svg=true)](https://ci.appveyor.com/project/xuhdev/editorconfig-core-c/branch/master) EditorConfig makes it easy to maintain the correct coding style when switching between different text editors and between different projects. The diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/appveyor.yml new/editorconfig-core-c-0.12.2/appveyor.yml --- old/editorconfig-core-c-0.12.1/appveyor.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/appveyor.yml 2018-03-15 22:02:13.000000000 +0100 @@ -0,0 +1,42 @@ +image: + - Visual Studio 2017 + +environment: + CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' + CONFIG: Release + ARCH: x64 + CMAKE_INSTALL_PREFIX: ..\build + PCRE_DEST: C:\projects\bin\%ARCH%-static\pcre + CORE_DEST: C:\projects\bin\%ARCH%-static\core + +install: + - cmake --version + - git submodule init + - git submodule update + - cd C:\projects + # Download PCRE sources + - curl -o pcre.zip https://ftp.pcre.org/pub/pcre/pcre-8.41.zip + - 7z x -y pcre.zip > nul + - rename pcre-8.41 pcre + # Build and install PCRE + - mkdir %PCRE_DEST% + - cd %PCRE_DEST% + - cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX="%CMAKE_INSTALL_PREFIX%" -DPCRE_STATIC_RUNTIME="ON" -DBUILD_SHARED_LIBS="OFF" -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_BUILD_TESTS=OFF C:\projects\pcre + - cd %PCRE_DEST% + - cmake --build %PCRE_DEST% --target install -- /p:Configuration=%CONFIG% + +build_script: + # Build and install editorconfig-core-c + - mkdir %CORE_DEST% + - cd %CORE_DEST% + - cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX="%CMAKE_INSTALL_PREFIX%" -DMSVC_MD="OFF" -DPCRE_STATIC="ON" C:\projects\editorconfig-core-c + - cmake --build %CORE_DEST% --target install -- /p:Configuration=%CONFIG% + +test_script: + # Run the core tests + - cd %CORE_DEST% + - cmake --build %CORE_DEST% --target run_tests -- /p:Configuration=%CONFIG% + +on_failure: + - echo. && echo. && echo. && echo "Tests for editorconfig-core-c failed. Here is their detailed output:" && echo. && echo. && echo. + - type C:\projects\bin\x64-static\core\Testing\Temporary\LastTest.log diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/doc/CMakeLists.txt new/editorconfig-core-c-0.12.2/doc/CMakeLists.txt --- old/editorconfig-core-c-0.12.1/doc/CMakeLists.txt 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/doc/CMakeLists.txt 2018-03-15 22:02:13.000000000 +0100 @@ -107,17 +107,17 @@ # we need to exclude it when installing man3. Same for # editorconfig-format.3 install(DIRECTORY ${EC_MANPAGE3_DIR} - DESTINATION share/man + DESTINATION "${CMAKE_INSTALL_MANDIR}" PATTERN editorconfig.3 EXCLUDE PATTERN editorconfig-format.3 EXCLUDE REGEX ._include_. EXCLUDE) install(FILES ${EC_MANPAGE1_DIR}/editorconfig.1 - DESTINATION share/man/man1) + DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") install(FILES ${EC_MANPAGE5_DIR}/editorconfig-format.5 - DESTINATION share/man/man5) + DESTINATION "${CMAKE_INSTALL_MANDIR}/man5") # "make clean" should also clean generated docs set_directory_properties(PROPERTIES @@ -125,7 +125,7 @@ if(INSTALL_HTML_DOC) install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" - DESTINATION share/doc/editorconfig) + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/editorconfig") endif(INSTALL_HTML_DOC) else(DOXYGEN_FOUND) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/include/CMakeLists.txt new/editorconfig-core-c-0.12.2/include/CMakeLists.txt --- old/editorconfig-core-c-0.12.1/include/CMakeLists.txt 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/include/CMakeLists.txt 2018-03-15 22:02:13.000000000 +0100 @@ -27,5 +27,5 @@ install(FILES editorconfig/editorconfig.h editorconfig/editorconfig_handle.h - DESTINATION include/editorconfig) + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/editorconfig") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/include/editorconfig/editorconfig.h new/editorconfig-core-c-0.12.2/include/editorconfig/editorconfig.h --- old/editorconfig-core-c-0.12.1/include/editorconfig/editorconfig.h 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/include/editorconfig/editorconfig.h 2018-03-15 22:02:13.000000000 +0100 @@ -161,11 +161,17 @@ * * @endmanonly * - * The backslash character (\) can be used to escape a character so it is not interpreted as a special character. + * The backslash character (\) can be used to escape a character so it is not + * interpreted as a special character. + * + * The maximum length of a section name is 4096 characters. All sections + * exceeding this limit are ignored. * * @section properties Supported Properties * - * EditorConfig file sections contain properties, which are name-value pairs separated by an equal sign (=). EditorConfig plugins will ignore unrecognized property names and properties with invalid values. + * EditorConfig file sections contain properties, which are name-value pairs + * separated by an equal sign (=). EditorConfig plugins will ignore unrecognized + * property names and properties with invalid values. * * Here is the list of all property names understood by EditorConfig and all valid values for these properties: * @@ -180,7 +186,14 @@ * <li><strong>root</strong>: special property that should be specified at the top of the file outside of any sections. Set to "true" to stop <code>.editorconfig</code> files search on current file. The value is case insensitive.</li> * </ul> * - * Property names are case insensitive and all property names are lowercased when parsing. + * For any property, a value of "unset" is to remove the effect of that + * property, even if it has been set before. For example, add "indent_size = + * unset" to undefine indent_size property (and use editor default). + * + * Property names are case insensitive and all property names are lowercased + * when parsing. The maximum length of a property name is 50 characters and the + * maximum length of a property value is 255 characters. Any property beyond + * these limits would be ignored. */ /*! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/mk-src-archive.sh new/editorconfig-core-c-0.12.2/mk-src-archive.sh --- old/editorconfig-core-c-0.12.1/mk-src-archive.sh 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/mk-src-archive.sh 2018-03-15 22:02:13.000000000 +0100 @@ -10,5 +10,5 @@ exit fi -curl -L https://raw.github.com/Kentzo/git-archive-all/master/git-archive-all | python - editorconfig-core-c-$*.tar.gz -curl -L https://raw.github.com/Kentzo/git-archive-all/master/git-archive-all | python - editorconfig-core-c-$*.zip +curl -L https://raw.githubusercontent.com/Kentzo/git-archive-all/master/git_archive_all.py | python - editorconfig-core-c-$*.tar.gz +curl -L https://raw.githubusercontent.com/Kentzo/git-archive-all/master/git_archive_all.py | python - editorconfig-core-c-$*.zip diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/bin/CMakeLists.txt new/editorconfig-core-c-0.12.2/src/bin/CMakeLists.txt --- old/editorconfig-core-c-0.12.1/src/bin/CMakeLists.txt 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/bin/CMakeLists.txt 2018-03-15 22:02:13.000000000 +0100 @@ -32,7 +32,7 @@ endif(CMAKE_COMPILER_IS_GNUCC) option(BUILD_STATICALLY_LINKED_EXE - "Link the standard library statically when building the executable.(Only valid for gcc)" + "Statically link all libraries when building the executable." ${BUILD_STATICALLY_LINKED_EXE_DEFAULT_VAL}) if(CMAKE_COMPILER_IS_GNUCC) @@ -47,12 +47,16 @@ # targets add_executable(editorconfig_bin ${editorconfig_BINSRCS}) -target_link_libraries(editorconfig_bin editorconfig_static) +if(BUILD_STATICALLY_LINKED_EXE) + target_link_libraries(editorconfig_bin editorconfig_static) +else(BUILD_STATICALLY_LINKED_EXE) + target_link_libraries(editorconfig_bin editorconfig_shared) +endif(BUILD_STATICALLY_LINKED_EXE) set_target_properties(editorconfig_bin PROPERTIES OUTPUT_NAME editorconfig VERSION ${editorconfig_VERSION_MAJOR}.${editorconfig_VERSION_MINOR}.${editorconfig_VERSION_PATCH}) install(TARGETS editorconfig_bin - RUNTIME DESTINATION bin) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/bin/main.c new/editorconfig-core-c-0.12.2/src/bin/main.c --- old/editorconfig-core-c-0.12.1/src/bin/main.c 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/bin/main.c 2018-03-15 22:02:13.000000000 +0100 @@ -223,7 +223,8 @@ /* print error message */ fputs(editorconfig_get_error_msg(err_num), stderr); if (err_num > 0) - fprintf(stderr, "\"%s\"", editorconfig_handle_get_err_file(eh)); + fprintf(stderr, ":%d \"%s\"", err_num, + editorconfig_handle_get_err_file(eh)); fprintf(stderr, "\n"); exit(1); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/lib/CMakeLists.txt new/editorconfig-core-c-0.12.2/src/lib/CMakeLists.txt --- old/editorconfig-core-c-0.12.1/src/lib/CMakeLists.txt 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/lib/CMakeLists.txt 2018-03-15 22:02:13.000000000 +0100 @@ -24,8 +24,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -include(GNUInstallDirs) - set(editorconfig_LIBSRCS ec_glob.c editorconfig.c @@ -64,3 +62,10 @@ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/editorconfig.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/editorconfig.pc + @ONLY) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/editorconfig.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/lib/ec_glob.c new/editorconfig-core-c-0.12.2/src/lib/ec_glob.c --- old/editorconfig-core-c-0.12.1/src/lib/ec_glob.c 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/lib/ec_glob.c 2018-03-15 22:02:13.000000000 +0100 @@ -36,6 +36,9 @@ #include "ec_glob.h" +/* Special characters */ +const char ec_special_chars[] = "?[]\\*-{},"; + typedef struct int_pair { int num1; @@ -52,7 +55,7 @@ p += string_len; \ } while(0) -#define PATTERN_MAX 300 +#define PATTERN_MAX 4097 /* * Whether the string matches the given glob pattern */ @@ -169,11 +172,21 @@ { char * right_bracket = strchr(c, ']'); + if (!right_bracket) /* The right bracket may not exist */ + right_bracket = c + strlen(c); + strcat(p_pcre, "\\"); strncat(p_pcre, c, right_bracket - c); - strcat(p_pcre, "\\]"); + if (*right_bracket) /* right_bracket is a bracket */ + strcat(p_pcre, "\\]"); p_pcre += strlen(p_pcre); c = right_bracket; + if (!*c) + /* end of string, meaning that right_bracket is not a + * bracket. Then we go back one character to make the + * parsing end normally for the counter in the "for" + * loop. */ + c -= 1; break; } } @@ -314,7 +327,10 @@ re = pcre_compile(pcre_str, 0, &error_msg, &erroffset, NULL); if (!re) /* failed to compile */ + { + utarray_free(nums); return -1; + } pcre_result_len = 3 * (utarray_len(nums) + 1); pcre_result = (int *) calloc(pcre_result_len, sizeof(int_pair)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/lib/ec_glob.h new/editorconfig-core-c-0.12.2/src/lib/ec_glob.h --- old/editorconfig-core-c-0.12.1/src/lib/ec_glob.h 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/lib/ec_glob.h 2018-03-15 22:02:13.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Hong Xu <hong AT topbug DOT net> + * Copyright (c) 2014-2018 Hong Xu <hong AT topbug DOT net> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,6 +36,10 @@ #endif EDITORCONFIG_LOCAL int ec_glob(const char * pattern, const char * string); + +/* Special characters. */ +extern const char ec_special_chars[]; + #ifdef __cplusplus } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/lib/editorconfig.c new/editorconfig-core-c-0.12.2/src/lib/editorconfig.c --- old/editorconfig-core-c-0.12.1/src/lib/editorconfig.c 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/lib/editorconfig.c 2018-03-15 22:02:13.000000000 +0100 @@ -89,7 +89,7 @@ !strcmp(nv->name, "charset")) strlwr(nv->value); - /* set speical pointers */ + /* set special pointers */ set_special_property_name_value_pointers(nv, spnvp); } @@ -228,16 +228,34 @@ return 1; } - /* pattern would be: /dir/of/editorconfig/file[double_star]/[section] if + /* Pattern would be: /dir/of/editorconfig/file[double_star]/[section] if * section does not contain '/', or /dir/of/editorconfig/file[section] * if section starts with a '/', or /dir/of/editorconfig/file/[section] if - * section contains '/' but does not start with '/' */ + * section contains '/' but does not start with '/'. + * + * If the dir part has any special characters as defined by ec_glob.c, we + * need to escape them. + */ pattern = (char*)malloc( - strlen(hfparam->editorconfig_file_dir) * sizeof(char) + + /* The 2 here is for possible escaping. */ + strlen(hfparam->editorconfig_file_dir) * sizeof(char) * 2 + sizeof("**/") + strlen(section) * sizeof(char)); if (!pattern) return 0; - strcpy(pattern, hfparam->editorconfig_file_dir); + + /* Escaping special characters in the directory part. */ + char* ptr = hfparam->editorconfig_file_dir; + char* ptr_prev = ptr; + char* ptr_pattern = pattern; + for (; ptr = strpbrk(ptr, ec_special_chars); ++ ptr, ptr_prev = ptr) + { + ptrdiff_t s = ptr - ptr_prev; + memcpy(ptr_pattern, ptr_prev, s * sizeof(char)); + ptr_pattern += s; + *(ptr_pattern ++) = '\\'; /* escaping char */ + *(ptr_pattern ++) = *ptr; + } + strcpy(ptr_pattern, ptr_prev); if (strchr(section, '/') == NULL) /* No / is found, append '[star][star]/' */ strcat(pattern, "**/"); @@ -409,7 +427,7 @@ if (editorconfig_compare_version(&eh->ver, &cur_ver) > 0) return EDITORCONFIG_PARSE_VERSION_TOO_NEW; - if (!eh->err_file) { + if (eh->err_file) { free(eh->err_file); eh->err_file = NULL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/lib/editorconfig.pc.in new/editorconfig-core-c-0.12.2/src/lib/editorconfig.pc.in --- old/editorconfig-core-c-0.12.1/src/lib/editorconfig.pc.in 1970-01-01 01:00:00.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/lib/editorconfig.pc.in 2018-03-15 22:02:13.000000000 +0100 @@ -0,0 +1,9 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/editorconfig + +Name: editorconfig +Description: Library handling EditorConfig files, a file format defining coding styles in projects. +Version: @editorconfig_VERSION_MAJOR@.@editorconfig_VERSION_MINOR@.@editorconfig_VERSION_PATCH@ +Libs: -L${libdir} -leditorconfig +Cflags: -I${includedir} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/lib/editorconfig_handle.c new/editorconfig-core-c-0.12.2/src/lib/editorconfig_handle.c --- old/editorconfig-core-c-0.12.1/src/lib/editorconfig_handle.c 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/lib/editorconfig_handle.c 2018-03-15 22:02:13.000000000 +0100 @@ -112,7 +112,7 @@ ((struct editorconfig_handle*)h)->ver.minor = minor; if (patch >= 0) - ((struct editorconfig_handle*)h)->ver.patch = minor; + ((struct editorconfig_handle*)h)->ver.patch = patch; } /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/lib/ini.c new/editorconfig-core-c-0.12.2/src/lib/ini.c --- old/editorconfig-core-c-0.12.1/src/lib/ini.c 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/lib/ini.c 2018-03-15 22:02:13.000000000 +0100 @@ -40,7 +40,7 @@ #include "ini.h" -#define MAX_LINE 200 +#define MAX_LINE 5000 #define MAX_SECTION MAX_SECTION_NAME #define MAX_NAME MAX_PROPERTY_NAME @@ -104,8 +104,8 @@ { /* Uses a fair bit of stack (use heap instead if you need to) */ char line[MAX_LINE]; - char section[MAX_SECTION] = ""; - char prev_name[MAX_NAME] = ""; + char section[MAX_SECTION+1] = ""; + char prev_name[MAX_NAME+1] = ""; char* start; char* end; @@ -144,6 +144,9 @@ end = find_last_char_or_comment(start + 1, ']'); if (*end == ']') { *end = '\0'; + /* Section name too long. Skipped. */ + if (end - start - 1 > MAX_SECTION_NAME) + continue; strncpy0(section, start + 1, sizeof(section)); *prev_name = '\0'; } @@ -167,6 +170,11 @@ *end = '\0'; rstrip(value); + /* Either name or value is too long. Skip it. */ + if (strlen(name) > MAX_PROPERTY_NAME || + strlen(value) > MAX_PROPERTY_VALUE) + continue; + /* Valid name[=:]value pair found, call handler */ strncpy0(prev_name, name, sizeof(prev_name)); if (!handler(user, section, name, value) && !error) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/editorconfig-core-c-0.12.1/src/lib/ini.h new/editorconfig-core-c-0.12.2/src/lib/ini.h --- old/editorconfig-core-c-0.12.1/src/lib/ini.h 2016-03-18 05:04:05.000000000 +0100 +++ new/editorconfig-core-c-0.12.2/src/lib/ini.h 2018-03-15 22:02:13.000000000 +0100 @@ -77,8 +77,9 @@ #define INI_ALLOW_MULTILINE 0 #endif -#define MAX_SECTION_NAME 500 -#define MAX_PROPERTY_NAME 500 +#define MAX_SECTION_NAME 4096 +#define MAX_PROPERTY_NAME 50 +#define MAX_PROPERTY_VALUE 255 /* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of the file. See http://code.google.com/p/inih/issues/detail?id=21 */