* save current changes

* save more changes

* wrap implementation

* address comments

* fix linting errors

* fix ytpo

Co-authored-by: Henry Li <lihl@microsoft.com>
This commit is contained in:
Henry Li 2021-08-26 10:26:23 -07:00 коммит произвёл GitHub
Родитель 504f1b50c4
Коммит f21e8f1518
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
18 изменённых файлов: 1088 добавлений и 49 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -289,7 +289,9 @@
"ant-contrib",
"bazel-workspaces",
"boringssl",
"cni",
"envoy",
"fillup",
"golang-packaging",
"jna",
"kured"
@ -340,7 +342,7 @@
"cloud-init",
"cloud-utils-growpart",
"cmake",
"cni",
"cni-plugins",
"core-packages",
"coreutils",
"cpio",

Просмотреть файл

@ -0,0 +1,5 @@
{
"Signatures": {
"cni-plugins-0.9.1.tar.gz": "35e96c6c47b9d080d1cbdcfca02808b01a95464607cd2a2c971b3ad596285928"
}
}

Просмотреть файл

@ -0,0 +1,70 @@
%define _default_cni_plugins_dir /opt/cni/bin
Summary: Container Network Interface (CNI) plugins
Name: cni-plugins
Version: 0.9.1
Release: 1%{?dist}
License: ASL 2.0
Vendor: Microsoft Corporation
Distribution: Mariner
Group: Development/Tools
# cni moved to https://github.com/containernetworking/cni/issues/667#issuecomment-491693752
URL: https://github.com/containernetworking/plugins
#Source0: https://github.com/containernetworking/plugins/archive/v%{version}.tar.gz
Source0: %{name}-%{version}.tar.gz
BuildRequires: golang >= 1.5
%description
The CNI (Container Network Interface) project consists of a specification and libraries for writing plugins to configure network interfaces in Linux containers, along with a number of supported plugins.
%prep
%setup -q -n plugins-%{version}
%build
./build_linux.sh
%install
install -vdm 755 %{buildroot}%{_default_cni_plugins_dir}
install -vpm 0755 -t %{buildroot}%{_default_cni_plugins_dir} bin/*
%check
make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
%post
%postun
%files
%defattr(-,root,root)
%license LICENSE
%{_default_cni_plugins_dir}/*
%changelog
* Tue Aug 17 2021 Henry Li <lihl@microsoft.com> - 0.8.1-1
- Rename package name from cni to cni-plugins
- Upgrade to version 0.9.1
* Thu Dec 10 2020 Andrew Phelps <anphel@microsoft.com> 0.7.5-5
- Increment release to force republishing using golang 1.15.
* Sat May 09 2020 Nick Samson <nisamson@microsoft.com> 0.7.5-4
- Added %%license line automatically
* Thu Apr 30 2020 Emre Girgin <mrgirgin@microsoft.com> 0.7.5-3
- Renaming go to golang
* Tue Mar 07 2020 Paul Monson <paulmon@microsoft.com> 0.7.5-3
- Fix Source0. License verified.
* Tue Sep 03 2019 Mateusz Malisz <mamalisz@microsoft.com> 0.7.5-2
- Initial CBL-Mariner import from Photon (license: Apache2).
* Tue Apr 02 2019 Ashwin H <ashwinh@vmware.com> 0.7.5-1
- Update cni to v0.7.5
* Tue Dec 05 2017 Vinay Kulkarni <kulkarniv@vmware.com> 0.6.0-1
- cni v0.6.0.
* Fri Apr 7 2017 Alexey Makhalov <amakhalov@vmware.com> 0.5.1-1
- Version update
* Thu Feb 16 2017 Vinay Kulkarni <kulkarniv@vmware.com> 0.4.0-1
- Add CNI plugins package to PhotonOS.

Просмотреть файл

@ -0,0 +1,4 @@
{
"cniVersion": "0.4.0",
"type": "loopback"
}

29
SPECS/cni/build.sh Normal file
Просмотреть файл

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
ORG_PATH="github.com/containernetworking"
REPO_PATH="${ORG_PATH}/cni"
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
export GO15VENDOREXPERIMENT=1
export GOPATH=${PWD}/gopath
echo "Building API"
go build -buildmode=pie "$@" ${REPO_PATH}/libcni
echo "Building reference CLI"
go build -buildmode=pie -o ${PWD}/bin/cnitool "$@" ${REPO_PATH}/cnitool
echo "Building plugins"
PLUGINS="plugins/test/*"
for d in $PLUGINS; do
if [ -d $d ]; then
plugin=$(basename $d)
echo " " $plugin
go build -buildmode=pie -o ${PWD}/bin/$plugin "$@" ${REPO_PATH}/$d
fi
done

Просмотреть файл

@ -1,5 +1,7 @@
{
"Signatures": {
"cni-v0.7.5.tar.gz": "92c7599918be0a720ac020f137cdeac746dfa03da6b26e08a37132c5728c091f"
"99-loopback.conf": "82e03a3292ca327bcc86af3664a0d7b110cb1c39bca16d3cc703abd49c3c9a1b",
"build.sh": "0626c2cc6371866f489ec1215e48a4192ece3e3019794ba7292e8d637d90eedc",
"cni-0.8.1.tar.gz": "6242e7905b5f8f7561a21f595209b569998727927380a8cdf5ab58e7fd5ac2d5"
}
}

Просмотреть файл

@ -1,63 +1,316 @@
Summary: Container Network Interface (CNI) plugins
#
# spec file for package cni
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cni_etc_dir %{_sysconfdir}/cni
%define cni_bin_dir %{_libexecdir}/cni
%define cni_doc_dir %{_docdir}/cni
# Remove stripping of Go binaries.
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true
Summary: Container Network Interface - networking for Linux containers
Name: cni
Version: 0.7.5
Release: 7%{?dist}
License: ASL 2.0
# cni moved to https://github.com/containernetworking/cni/issues/667#issuecomment-491693752
URL: https://github.com/containernetworking/plugins
#Source0: https://github.com/containernetworking/plugins/archive/v0.7.5.tar.gz
Source0: %{name}-v%{version}.tar.gz
Group: Development/Tools
Version: 0.8.1
Release: 2%{?dist}
License: Apache-2.0
Vendor: Microsoft Corporation
Distribution: Mariner
BuildRequires: golang >= 1.5
%define _default_cni_plugins_dir /opt/cni/bin
Group: System/Management
URL: https://github.com/containernetworking/cni
#Source0: https://github.com/containernetworking/cni/archive/refs/tags/v%{version}.tar.gz
Source0: %{name}-%{version}.tar.gz
Source1: 99-loopback.conf
Source2: build.sh
BuildRequires: golang
BuildRequires: systemd-rpm-macros
BuildRequires: xz
Requires: systemd
Requires(post): %fillup_prereq
Recommends: cni-plugins
%description
The CNI (Container Network Interface) project consists of a specification and libraries for writing plugins to configure network interfaces in Linux containers, along with a number of supported plugins.
The CNI (Container Network Interface) project consists of a
specification and libraries for writing plugins to configure
network interfaces in Linux containers, along with a number of
supported plugins. CNI concerns itself only with network
connectivity of containers and removing allocated resources when
the container is deleted. Because of this focus, CNI has a wide
range of support and the specification is simple to implement.
%prep
%setup -n plugins-%{version}
%setup -q
cp %{SOURCE2} build.sh
%build
./build.sh
# go1.16+ default is GO111MODULE=on set to auto temporarily
# until using upstream release with go.mod
export GO111MODULE=auto
sh ./build.sh
%install
install -vdm 755 %{buildroot}%{_default_cni_plugins_dir}
install -vpm 0755 -t %{buildroot}%{_default_cni_plugins_dir} bin/*
%check
make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
# install the plugins
install -m 755 -d "%{buildroot}%{cni_bin_dir}"
cp bin/noop "%{buildroot}%{cni_bin_dir}/"
cp bin/sleep "%{buildroot}%{cni_bin_dir}/"
# undo a copy: cnitool must go to sbin/
install -m 755 -d "%{buildroot}%{_sbindir}"
cp bin/cnitool "%{buildroot}%{_sbindir}/"
# config
install -m 755 -d "%{buildroot}%{cni_etc_dir}"
install -m 755 -d "%{buildroot}%{cni_etc_dir}/net.d"
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{cni_etc_dir}/net.d/99-loopback.conf.sample
# documentation
install -m 755 -d "%{buildroot}%{cni_doc_dir}"
%post
%postun
%{fillup_only -n %{name}}
%files
%defattr(-,root,root)
%doc CONTRIBUTING.md README.md DCO
%license LICENSE
%{_default_cni_plugins_dir}/*
%dir %{cni_etc_dir}
%dir %{cni_etc_dir}/net.d
%config %{cni_etc_dir}/net.d/*
%dir %{cni_bin_dir}
%dir %{cni_doc_dir}
%{cni_bin_dir}/*
%{cni_etc_dir}/net.d/*
%{_sbindir}/cnitool
%changelog
* Tue Jun 08 2021 Henry Beberman <henry.beberman@microsoft.com> 0.7.5-7
- Increment release to force republishing using golang 1.15.13.
* Mon Apr 26 2021 Nicolas Guibourge <nicolasg@microsoft.com> 0.7.5-6
- Increment release to force republishing using golang 1.15.11.
* Thu Dec 10 2020 Andrew Phelps <anphel@microsoft.com> 0.7.5-5
- Increment release to force republishing using golang 1.15.
* Sat May 09 2020 Nick Samson <nisamson@microsoft.com> 0.7.5-4
- Added %%license line automatically
* Thu Apr 30 2020 Emre Girgin <mrgirgin@microsoft.com> 0.7.5-3
- Renaming go to golang
* Tue Mar 07 2020 Paul Monson <paulmon@microsoft.com> 0.7.5-3
- Fix Source0. License verified.
* Tue Sep 03 2019 Mateusz Malisz <mamalisz@microsoft.com> 0.7.5-2
- Initial CBL-Mariner import from Photon (license: Apache2).
* Tue Apr 02 2019 Ashwin H <ashwinh@vmware.com> 0.7.5-1
- Update cni to v0.7.5
* Tue Dec 05 2017 Vinay Kulkarni <kulkarniv@vmware.com> 0.6.0-1
- cni v0.6.0.
* Fri Apr 7 2017 Alexey Makhalov <amakhalov@vmware.com> 0.5.1-1
- Version update
* Thu Feb 16 2017 Vinay Kulkarni <kulkarniv@vmware.com> 0.4.0-1
- Add CNI plugins package to PhotonOS.
* Tue Aug 17 2021 Henry Li <lihl@microsoft.com> - 0.8.1-2
- Initial CBL-Mariner import from OpenSUSE Tumbleweed
- License Verified
- Remove shadow from BR
- Use systemd and fillup from runtime requirements
- Manually define fillup-related macros
- Remove buildroot definition
* Mon May 31 2021 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to version 0.8.1:
* This is a security release that fixes a single bug:
- Tighten up plugin-finding logic (#811).
* Sat Apr 24 2021 Dirk Müller <dmueller@suse.com>
- use buildmode=pie (cnitool is installed into sbindir)
* Tue Mar 16 2021 Jeff Kowalczyk <jkowalczyk@suse.com>
- Set GO111MODULE=auto to build with go1.16+
* Default changed to GO111MODULE=on in go1.16
* Set temporarily until using upstream release with go.mod
* Drop BuildRequires: golang-packaging not currently using macros
* Add BuildRequires: golang(API) >= 1.13 recommended dependency expression
* Thu Oct 1 2020 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to version 0.8.0:
* Specification and Conventions changes
+ docs: add ips and mac to well-known capabilities
+ add interface name validation
+ Add GUID to well known Capabilities
+ Add DeviceID attribute to RuntimeConfig
+ Typo fixes for infiniband GUID
+ Fix linting issues in docs, add headers to json example, update errors into table
* Documentation changes
+ Update cnitool docs
+ Remove extra ',' chars which makes conflist examples invalid.
* libcni changes
+ Remove Result.String method
+ libcni: add config caching [v2]
+ clean up : fix staticcheck warnings
+ libcni: add InitCNIConfigWithCacheDir() and deprecate RuntimeConfig.CacheDir
+ skel: clean up errors in skel and add some well-known error codes
+ libcni: find plugin in exec
+ validate containerID and networkName
+ skel: remove needless functions and types
+ libcni: also cache IfName
+ libcni: fix cache file 'result' key name
+ Bump Go version to 1.13
+ When CNI version isn't supplied in config, use default.
+ intercept netplugin std error
+ invoke: capture and return stderr if plugin exits unexpectedly
+ Retry exec commands on text file busy
* Mon Jan 13 2020 Sascha Grunert <sgrunert@suse.com>
- Set correct CNI version for 99-loopback.conf
* Tue Jul 16 2019 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to version 0.7.1 (bsc#1160460):
* Library changes:
+ invoke : ensure custom envs of CNIArgs are prepended to process envs
+ add GetNetworkListCachedResult to CNI interface
+ delegate : allow delegation funcs override CNI_COMMAND env automatically in heritance
* Documentation & Convention changes:
+ Update cnitool documentation for spec v0.4.0
+ Add cni-route-override to CNI plugin list
* Build and test changes:
+ Release: bump go to v1.12
* Fri May 17 2019 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to version 0.7.0:
* Spec changes:
+ Use more RFC2119 style language in specification (must, should...)
+ add notes about ADD/DEL ordering
+ Make the container ID required and unique.
+ remove the version parameter from ADD and DEL commands.
+ Network interface name matters
+ be explicit about optional and required structure members
+ add CHECK method
+ Add a well-known error for "try again"
+ SPEC.md: clarify meaning of 'routes'
* Library changes:
+ pkg/types: Makes IPAM concrete type
+ libcni: return error if Type is empty
+ skel: VERSION shouldn't block on stdin
+ non-pointer instances of types.Route now correctly marshal to JSON
+ libcni: add ValidateNetwork and ValidateNetworkList functions
+ pkg/skel: return error if JSON config has no network name
+ skel: add support for plugin version string
+ libcni: make exec handling an interface for better downstream testing
+ libcni: api now takes a Context to allow operations to be timed out or cancelled
+ types/version: add helper to parse PrevResult
+ skel: only print about message, not errors
+ skel,invoke,libcni: implementation of CHECK method
+ cnitool: Honor interface name supplied via CNI_IFNAME environment variable.
+ cnitool: validate correct number of args
+ Don't copy gw from IP4.Gateway to Route.GW When converting from 0.2.0
+ add PrintTo method to Result interface
+ Return a better error when the plugin returns none
- Install sleep binary into CNI plugin directory
- Restore build.sh script which was removed upstream
* Tue Jun 5 2018 dcassany@suse.com
- Refactor %%license usage to a simpler form
* Mon Jun 4 2018 dcassany@suse.com
- Make use of %%license macro
* Wed Apr 4 2018 jmassaguerpla@suse.com
- Remove creating subvolumes. This should be in another package (kubernetes-kubelet)
* Mon Jan 29 2018 kmacinnes@suse.com
- Use full/absolute path for mksubvolume
- Change snapper Requires to a Requires(post)
* Thu Jan 18 2018 kmacinnes@suse.com
- Add snapper as a requirement, to provide mksubvolume
* Mon Jan 15 2018 alvaro.saurin@suse.com
- Make /var/lib/cni writable
* Tue Dec 19 2017 alvaro.saurin@suse.com
- Remove the dependency with the cni-plugins
- Recommend the cni-plugins
* Mon Aug 28 2017 opensuse-packaging@opensuse.org
- Update to version 0.6.0:
* Conventions: add convention around chaining interfaces
* pkg/types: safer typecasting for TextUnmarshaler when loading args
* pkg/types: modify LoadArgs to return a named error when an unmarshalable condition is detected
* Update note about next Community Sync, 2017-06-21
* types: fix marshalling of omitted "interfaces" key in IPConfig JSON
* Update and document release process
* scripts/release.sh: Add in s390x architecture
* cnitool: add support for CNI_ARGS
* README plugins list: add Linen CNI plugin
* Mon Apr 10 2017 opensuse-packaging@opensuse.org
- Update to version 0.5.2:
* Rename build script to avoid conflict with bazel
* Enable s390x build
* Update community sync detail
* Added entry for CNI-Genie
* travis: shift forward to Go 1.8 and 1.7
* spec/plugins: fix 'ip'->'ips' in the spec, bump to 0.3.1
* libcni: Improved error messages.
* libcni: Fixed tests that were checking error strings.
* Documentation: Added documentation for `cnitool`.
* Thu Mar 23 2017 opensuse-packaging@opensuse.org
- Update to version 0.5.1:
* readme.md: Add link to community sync
* pkg/ip: do not leak types from vendored netlink package
* pkg/ip: SetupVeth returns net.Interface
* pkg/ip: improve docstring for SetupVeth
* Added Romana to list of CNI providers...
* plugins/meta/flannel: If net config is missing do not return err on DEL
* plugins/*: Don't error if the device doesn't exist
* Wed Mar 22 2017 alvaro.saurin@suse.com
- Update to version 0.5.0:
* Documentation: Add conventions doc
* noop: allow specifying debug file in config JSON
* Spec/Conventions: Update to include plugin config
* spec: add network configuration list specification
* api,libcni: add network config list-based plugin chaining
* Update CONVENTIONS.md
* skel: adds PluginMainWithError which returns a *types.Error
* testutils: pass netConf in for version operations; pass raw result out for tests
* types: make Result an interface and move existing Result to separate package
* macvlan/ipvlan: use common RenameLink method
* plugins/flannel: organize test JSON alphabetically
* pkg/ipam: add testcases
* spec/plugins: return interface details and multiple IP addresses to runtime
* spec, libcni, pkg/invoke: Use OS-agnostic separator when parsing CNI_PATH
* pkg/utils/sysctl/sysctl_linux.go: fix build tag.
* pkg/utils/sysctl/sysctl_linux.go: fix typo.
* invoke: Enable plugin file names with extensions
* CONVENTIONS.md: Update details on port-mappings
* Update with feedback
* More markups
* spec: Remove `routes` from Network Configuration
* docs: consolidate host-local documentation
* pkg/ns: refactored so that builds succeed on non-linux platforms
* Fix grammar
* plugins/main/ptp: set the Sandbox property on the response
* README: List multus as 3rd party plugin
* Replace Michael Bridgen with Bryan Boreham
* pkg/ns, pkg/types: refactored non linux build fix code to
* pkg/ip: refactored so that builds succeed on non-linux platforms
* vendor: Update vishvanana/netlink dependency
* libcni: up-convert a Config to a ConfigList when no other configs are found.
* docs: CNI versioning for 0.3.0 upgrade
* docs: Edits to v0.3.0 upgrade guidance
* docs: minor improvements to 0.3.0 upgrade guidance
* docs: add small upgrade instructions
* docs: minor improvements to spec-upgrades
* docs: fill-out and correct version conversion table
* docs: table formatting is hard
* pkg/testutils: return errors after restoring stdout
* pkg/types: misc current types testcase cleanups
* Minor rewording about default config version
* spec,libcni: add support for injecting runtimeConfig into plugin stdin data
* Check n.IPAM before use it in LoadIPAMConfig function
* do not error if last_reserved_ip is missing for host local ipam
* add test for ensuring initial subnet creation does not contain an error
* fix unrelated failing tests
* Wed Mar 1 2017 opensuse-packaging@opensuse.org
- Update to version 0.4.0:
* plugins/noop: return a helpful message for test authors
* host-local: trim whitespace from container IDs and disk file contents
* travis: roll forward the versions of Go that we test
* MAINTAINERS: hi CaseyC!
* ipam/host-local: Move allocator and config to backend
* ipam/host-local: add ResolvConf argument for DNS configuration
* spec: notice of version
* Thu Feb 23 2017 alvaro.saurin@suse.com
- Initial version

Просмотреть файл

@ -0,0 +1,20 @@
--- SRC/services.c.orig
+++ SRC/services.c
@@ -342,7 +342,7 @@ openFileForReading
{
Service_t returnValue;
- *filePointer = fopen( filename, "r" );
+ *filePointer = fopen( filename, "re" );
if( *filePointer == NULL )
{
fillup_exception( __FILE__, __LINE__, ServiceException,
@@ -368,7 +368,7 @@ openFileForWriting
{
Service_t returnValue;
- *filePointer = fopen( filename, "w" );
+ *filePointer = fopen( filename, "we" );
if( *filePointer == NULL )
{
fillup_exception( __FILE__, __LINE__, ServiceException,

Просмотреть файл

@ -0,0 +1,226 @@
--- SRC/consume.c.orig
+++ SRC/consume.c
@@ -140,7 +140,7 @@ consumeUptoBreak
{
break; /* line break detected */
}
- else if( *buffer == EOF )
+ else if( *buffer == 0 )
{
break; /* End-Of-File detected */
}
--- SRC/file.c.orig
+++ SRC/file.c
@@ -35,18 +35,34 @@ readFile
File_t returnValue;
FILE * filePointer;
long fileLength;
- char * buffer = NULL;
if( FileOpened == openFileForReading( filename, &filePointer ) )
{
if( Success == getFileLength( filePointer, &fileLength ) )
{
- if( Success ==
- allocateBuffer( fileLength, ( void ** )&buffer ) )
+ void * ptr;
+
+ /*
+ * Allocate one byte more if a newline must be added
+ */
+ if( Success == allocateBuffer( fileLength + 1 , &ptr ) )
{
- if( Success ==
- readFileToBuffer( filePointer, fileLength, &buffer ) )
- {
+ char * buffer = ( char * )ptr;
+
+ if( Success == readFileToBuffer( filePointer, fileLength, &buffer ) )
+ {
+
+ if ( FALSE == queryParameter( IgnoreEOF ) )
+ {
+ char * eof = (buffer + fileLength - 1);
+
+ if ( *eof != '\n' )
+ {
+ *( eof + 1 ) = '\n';
+ fileLength++;
+ }
+ }
+
addToWatchdog( fileLength );
associateBuffer( fileSpecifier, fileLength, &buffer );
returnValue = FileOperationsSuccessful;
--- SRC/parameters.c.orig
+++ SRC/parameters.c
@@ -368,6 +368,13 @@ queryParameter
}
break;
+ case IgnoreEOF:
+ if( parameterIgnoreEOF == IsSet )
+ {
+ returnValue = TRUE;
+ }
+ break;
+
case IgnoreDefinites:
if( parameterIgnoreDefinites == IsSet )
{
--- SRC/parser.c.orig
+++ SRC/parser.c
@@ -19,7 +19,7 @@
/*--------------------------------- IMPORTS ----------------------------------*/
#include <ctype.h>
-
+#include <unistd.h>
#include "portab.h"
#include "variableblock.h"
#include "parameters.h"
@@ -296,6 +296,7 @@ createAdministrationInfo
unsigned long Size;
char * delimiterString;
char delimiterChar;
+ void * ptr;
queryStringParameter( Delimiter, &delimiterString );
delimiterChar = delimiterString[ 0 ];
@@ -305,23 +306,25 @@ createAdministrationInfo
countDelimiters( delimiterChar, baseFileBuffer, baseFileBufferLength );
baseFileBlocksLength++; /* add possible trailing comment */
Size = baseFileBlocksLength * sizeof( VariableBlock_t );
- if( Success != allocateBuffer( Size, ( void ** )&baseFileBlock ) )
+ if( Success != allocateBuffer( Size, &ptr ) )
{
fillup_exception( __FILE__, __LINE__, ConfigurationException,
"createAdministrationInfo" );
exitOnFailure( );
}
+ baseFileBlock = ( VariableBlock_t * )ptr;
additionalFileBlocksLength = countDelimiters(
delimiterChar, additionalFileBuffer, additionalFileBufferLength );
additionalFileBlocksLength++; /* add possible trailing comment */
Size = additionalFileBlocksLength * sizeof( VariableBlock_t );
- if( Success != allocateBuffer( Size, ( void ** )&additionalFileBlock ) )
+ if( Success != allocateBuffer( Size, &ptr ) )
{
fillup_exception( __FILE__, __LINE__, ConfigurationException,
"createAdministrationInfo" );
exitOnFailure( );
}
+ additionalFileBlock = ( VariableBlock_t * )ptr;
if( queryParameter( ForbiddenFile ) == TRUE )
{
@@ -329,12 +332,13 @@ createAdministrationInfo
delimiterChar, forbiddenFileBuffer, forbiddenFileBufferLength );
forbiddenFileBlocksLength++; /* add possible trailing comment */
Size = forbiddenFileBlocksLength * sizeof( VariableBlock_t );
- if( Success != allocateBuffer( Size, ( void ** )&forbiddenFileBlock ) )
+ if( Success != allocateBuffer( Size, &ptr ) )
{
fillup_exception( __FILE__, __LINE__, ConfigurationException,
"createAdministrationInfo" );
exitOnFailure( );
}
+ forbiddenFileBlock = ( VariableBlock_t * )ptr;
}
}
@@ -477,8 +481,8 @@ getVariable
getVBeginOfBlock( outputBuffer, &Line );
Line = Line + getVLength( outputBuffer );
LinePointer = Line;
- for( lineIndex = 0;
- ( *LinePointer != EOF ) && ( *LinePointer != '\n' );
+ for( lineIndex = 0;
+ ( *LinePointer != 0 ) && ( *LinePointer != '\n' ) ;
lineIndex++ )
{
LinePointer++; /* concerns only the current line */
@@ -1768,6 +1772,8 @@ writeOutput
}
listPointer++;
}
+ if(fflush( filePointer ) != 0) fillup_exception( __FILE__, __LINE__, ServiceException, "cannot flush stream");
+ if(fdatasync ( fileno(filePointer) ) != 0) fillup_exception( __FILE__, __LINE__, ServiceException, "cannot sync stream");
closeFile( filePointer );
}
}
@@ -1830,7 +1836,9 @@ writeOutput
default: break;
}
listPointer++;
- }
+ }
+ if(fflush( filePointer ) != 0) fillup_exception( __FILE__, __LINE__, ServiceException, "cannot flush stream");
+ if(fdatasync ( fileno(filePointer) ) != 0) fillup_exception( __FILE__, __LINE__, ServiceException, "cannot sync stream");
closeFile( filePointer );
}
}
--- SRC/services.c.orig
+++ SRC/services.c
@@ -444,8 +444,9 @@ readFileToBuffer
if( 0 == fseek( filePointer, 0L, SEEK_SET ) )
{
- if( fileLength ==
- ( long )fread( *fileBuffer, sizeof( char ), fileLength, filePointer ) )
+ if( ( fileLength ==
+ ( long )fread( *fileBuffer, sizeof( char ), fileLength, filePointer ) )
+ && ( 0 == ferror( filePointer ) ) )
{
returnValue = Success;
}
@@ -558,23 +559,22 @@ dumpBlock
Service_t
allocateBuffer
(
- long fileLength, /* in */
+ long Length, /* in */
void ** buffer /* out */
)
{
Service_t returnValue;
- *buffer = malloc( fileLength + 1 );
+ *buffer = malloc( Length + 1 );
if( *buffer == NULL )
{
- fillup_exception( __FILE__, __LINE__, ServiceException,
- "malloc" );
+ fillup_exception( __FILE__, __LINE__, ServiceException, "malloc" );
returnValue = Error;
}
else
{
/* reset the buffer */
- ( void )memset( *buffer, EOF, fileLength + 1 );
+ ( void )memset( *buffer, 0, Length + 1 );
returnValue = Success;
}
--- SRC/metadata.c.orig
+++ SRC/metadata.c
@@ -17,7 +17,7 @@
/*--------------------------------- IMPORTS ----------------------------------*/
#include <stdio.h>
-
+#include <unistd.h>
#include "variableblock.h"
#include "services.h"
#include "parser.h"
@@ -392,7 +392,8 @@ setMetadataInfo
logfile );
fprintf( logfile, ">\n\n" );
}
-
+ if(fflush( logfile ) != 0) fillup_exception( __FILE__, __LINE__, ServiceException, "cannot flush stream");
+ if(fdatasync( fileno(logfile) ) != 0) fillup_exception( __FILE__, __LINE__, ServiceException, "cannot sync stream");
closeFile( logfile );
}
}

Просмотреть файл

@ -0,0 +1,17 @@
Index: fillup-1.42/SRC/fillup_cfg.h
===================================================================
--- fillup-1.42.orig/SRC/fillup_cfg.h
+++ fillup-1.42/SRC/fillup_cfg.h
@@ -23,9 +23,9 @@
/*-------------------------------- VARIABLES ---------------------------------*/
-const char * cfg_delimiter;
-const char * cfg_commentMarker;
-const char * cfg_quotingMarker;
+extern const char * cfg_delimiter;
+extern const char * cfg_commentMarker;
+extern const char * cfg_quotingMarker;
/*----------------------------------------------------------------------------*/

Просмотреть файл

@ -0,0 +1,23 @@
Index: SRC/services.c
===================================================================
--- SRC/services.c.orig
+++ SRC/services.c
@@ -263,11 +263,15 @@ displayVersion
)
{
static const char *versionString =
- "This is fillup, version %1.2f, compiled on %s\n\n";
+ "This is fillup, version %1.2f\n\n";
- if( ( int )( strlen( versionString ) + strlen( __DATE__ ) - 3 ) !=
- fprintf( stderr, versionString, VERSION, __DATE__ ) )
+ if( ( int )( strlen( versionString ) - 1 ) !=
+ fprintf( stderr, versionString, VERSION ) )
{
+int res= fprintf( stderr, versionString, VERSION );
+
+fprintf (stderr,"strlen: %d, res: %d\n", strlen( versionString ), res);
+
fillup_exception( __FILE__, __LINE__, ServiceException,
"displayVersion" );
exitOnFailure( );

Просмотреть файл

@ -0,0 +1,41 @@
--- SRC/Makefile.orig
+++ SRC/Makefile
@@ -37,7 +37,7 @@ ARCHIVE = ${PROJDIR}/ARCHIVE
WARNINGS = -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes
# WARNINGS = -Wunused -Wswitch -Wformat -Wreturn-type -Wimplicit -Wmissing-prototypes -Wmissing-declarations
-DEFINES =
+DEFINES = -D_GNU_SOURCE
# LINUX system
OPTISPLUS =
@@ -46,24 +46,23 @@ INC = -I/usr/include
COMPILER = -DGCC=1
# Set OPTIS to the following values
-OPTIS = $(OPTISPLUS) -O2 -fforce-addr -finline-functions -fno-function-cse \
- -fkeep-inline-functions
+OPTIS = $(OPTISPLUS) -O2
ifeq ($(COMPILE_OPTION),DEBUG)
# compile for debugging
- COMPILE = gcc -fsigned-char -DDEBUG -ansi -g -c ${WARNINGS} -I${SRC} -I${INC} ${COMPILER} ${SYS} ${DEFINES}
+ COMPILE = gcc -DDEBUG -std=gnu99 -g -c $(OPTIS) ${WARNINGS} -I${SRC} -I${INC} ${COMPILER} ${SYS} ${DEFINES}
LINK = gcc -g
endif
ifeq ($(COMPILE_OPTION),OPTIMIZE)
# compile with all optimizations
- COMPILE = gcc -fsigned-char -ansi -c $(OPTIS) $(WARNINGS) -I${SRC} -I${INC} ${COMPILER} ${SYS} ${DEFINES}
- LINK = gcc -O -s
+ COMPILE = gcc -std=gnu99 -c $(OPTIS) $(WARNINGS) -I${SRC} -I${INC} ${COMPILER} ${SYS} ${DEFINES}
+ LINK = gcc
endif
ifeq ($(COMPILE_OPTION),PROFILE)
# compile for use with "gprof"
- COMPILE = gcc -fsigned-char -ansi -pg -c ${WARNINGS} -I${SRC} -I${INC} ${COMPILER} ${SYS} ${DEFINES}
+ COMPILE = gcc -ansi -pg -c ${WARNINGS} -I${SRC} -I${INC} ${COMPILER} ${SYS} ${DEFINES}
LINK = gcc -pg
endif

Просмотреть файл

@ -0,0 +1,11 @@
--- TEST/FCSR/SRC/CreateRemoved.c
+++ TEST/FCSR/SRC/CreateRemoved.c
@@ -48,7 +48,7 @@
printf( "\n" );
index = 0;
- if( argument & 0x2L ) return; /* single variable but removed */
+ if( argument & 0x2L ) return 0; /* single variable but removed */
argument = argument >> 2;
while( ( index < numberOfKeywords ) && ( argument > 0 ) )

Просмотреть файл

@ -0,0 +1,97 @@
diff -ruN fillup-1.42/SRC/metadata.c fillup-1.42-new/SRC/metadata.c
--- fillup-1.42/SRC/metadata.c 2003-09-10 14:20:00.000000000 +0200
+++ fillup-1.42-new/SRC/metadata.c 2005-07-06 10:50:55.000000000 +0200
@@ -165,6 +165,10 @@
MetadataKeyword_t loop;
long offset;
+ /* Both return values are explicitely initialized */
+ Result = Metadata_Number;
+ *length = 0;
+
offset = 0;
offset += consumeBlanksOrTabs( &precedingComment[ offset ], variableLength - offset );
for( loop=0; loop<Metadata_Number; loop++ )
diff -ruN fillup-1.42/SRC/parser.c fillup-1.42-new/SRC/parser.c
--- fillup-1.42/SRC/parser.c 2003-09-10 23:00:26.000000000 +0200
+++ fillup-1.42-new/SRC/parser.c 2005-07-06 11:01:35.000000000 +0200
@@ -106,6 +106,7 @@
long remainingInputChars /* in */
);
+#if DEBUG
static
void
printBlockInfo
@@ -121,13 +122,13 @@
VariableBlock_t * list /* in */
);
-
static
void
displayVerboseValue
(
long verboseValue /* in */
);
+#endif
static
void
@@ -597,6 +598,7 @@
}
}
+#if DEBUG
/*---------------- printBlockInfo ------------------*/
static
@@ -668,6 +670,7 @@
list = getVSucc( list );
}
}
+#endif
/*------------ displayVerboseString ---------------*/
void
@@ -682,6 +685,7 @@
}
}
+#if DEBUG
/*------------ displayVerboseValue ----------------*/
static
@@ -696,6 +700,7 @@
displayValue( verboseValue );
}
}
+#endif
/*------------ displayVerboseBuffer ---------------*/
@@ -907,6 +912,12 @@
break;
default:
+ /* next four statements are inserted to eliminate gcc warnings */
+ inputBuffer = (char *)NULL;
+ inputLength = 0;
+ outputBuffer = (VariableBlock_t *)NULL;
+ outputLength = 0;
+
fillup_exception( __FILE__, __LINE__, DefaultBranchException,
"parseFile" );
break;
diff -ruN fillup-1.42/SRC/services.c fillup-1.42-new/SRC/services.c
--- fillup-1.42/SRC/services.c 2003-09-10 14:20:01.000000000 +0200
+++ fillup-1.42-new/SRC/services.c 2005-07-06 14:03:37.000000000 +0200
@@ -251,7 +251,7 @@
char character /* in */
)
{
- ( void )fputc( character, stderr );
+ ( void )fputc( ( int )character, stderr );
}
/*---------------- displayVersion ------------------*/

Просмотреть файл

@ -0,0 +1,5 @@
{
"Signatures": {
"fillup-1.42.tar.gz": "9293715d9c38fb2a310eab4e2c0bf621660bbedd7a4f8439dbe731e512fac016"
}
}

214
SPECS/fillup/fillup.spec Normal file
Просмотреть файл

@ -0,0 +1,214 @@
#
# spec file for package fillup
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Summary: Tool for Merging Config Files
Name: fillup
Version: 1.42
Release: 277%{?dist}
License: GPLv2+
Vendor: Microsoft Corporation
Distribution: Mariner
Group: System/Base
URL: https://github.com/openSUSE/fillup
#Source0: https://github.com/openSUSE/%{name}/archive/refs/tags/%{version}.tar.gz
Source0: %{name}-%{version}.tar.gz
Patch0: %{name}-optflags.patch
Patch1: %{name}-warnings.dif
Patch2: %{name}-%{version}.dif
Patch3: %{name}-retval.dif
Patch4: %{name}-nodate.patch
Patch5: %{name}-1.42-cloexec.patch
Patch6: %{name}-fno-common.patch
Provides: /bin/%{name}
%description
fillup merges files that hold variables. A variable is defined by an
entity composed of a preceding comment, a variable name, an assignment
delimiter, and a related variable value. A variable is determined by
its variable name.
%prep
%setup -q
%patch0
%patch1 -p1
%patch2
%patch3
%patch4
%patch5
%patch6 -p1
%build
mkdir -p OBJ
mkdir -p BIN
make %{?_smp_mflags} compile COMPILE_OPTION=OPTIMIZE OPTISPLUS="%{optflags}"
%install
mkdir -p %{buildroot}%{_fillupdir}
install -d -m 755 %{buildroot}/%{_bindir}
install -m 755 BIN/fillup %{buildroot}/%{_bindir}
install -d %{buildroot}/%{_mandir}/man8
install -m 644 SGML/fillup.8.gz %{buildroot}/%{_mandir}/man8
%check
make %{?_smp_mflags} test OPTISPLUS="%{optflags}"
%files
%defattr(-,root,root)
%{_bindir}/fillup
%{_mandir}/man8/fillup*
%changelog
* Tue Aug 17 2021 Henry Li <lihl@microsoft.com> - 1.42-277
- Initial CBL-Mariner import from OpenSUSE Tumbleweed
- License Verified
- Update Source0 URL path
- Manually create BIN and OBJ folder to build the project
- Remove symbolic link on fillup
- Remove _fillupdir macro definition
* Fri Oct 16 2020 Ludwig Nussel <lnussel@suse.de>
- prepare usrmerge (boo#1029961)
* Wed Jan 15 2020 Adam Majer <adam.majer@suse.de>
- fillup-fno-common.patch: fix compilation on Tumbleweed
(boo#1160871)
* Thu Nov 23 2017 rbrown@suse.com
- Replace references to /var/adm/fillup-templates with new
%%_fillupdir macro (boo#1069468)
* Mon Nov 3 2014 tchvatal@suse.com
- Also return back the /bin/fillup provides line
* Fri Oct 31 2014 dimstar@opensuse.org
- Keep /bin/fillup as a symlink in the package: there are hundreds
of RPMs out there referencing it in the %%post scriptlets, when
any of the %%*fillup* macros was used. Even updating the macro
will not make the existing RPMs magically be fixed.
* Sun Oct 26 2014 tchvatal@suse.com
- Cleanup the mess in spec with spec-cleaner
* Wed Feb 8 2012 rschweikert@suse.com
- place binary into /usr tree (UsrMerge project)
* Fri Sep 30 2011 uli@suse.com
- cross-build workarounds: disable %%build section testing, use fake
gcc script to work around build system deficiencies
* Sun Sep 18 2011 jengelh@medozas.de
- Apply packaging guidelines (remove redundant/obsolete
tags/sections from specfile, etc.)
* Sat May 21 2011 crrodriguez@opensuse.org
- Open all file descriptors with O_CLOEXEC
- handle out-of-disk-space situations somewhat better.
* Mon Jun 28 2010 jengelh@medozas.de
- use %%_smp_mflags
* Sun Dec 13 2009 aj@suse.de
- Do not compile in date into binary to create reproduceable binaries.
* Sun Dec 13 2009 jengelh@medozas.de
- enable parallel building
* Wed Aug 26 2009 mls@suse.de
- make patch0 usage consistent
* Tue Sep 19 2006 rguenther@suse.de
- Do not install info or plaintext documentation (same as manpage).
- Remove sgmltool BuildRequires.
* Mon May 22 2006 schwab@suse.de
- Don't strip binaries.
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jan 11 2006 ro@suse.de
- fix missing return value in test-code (#139594)
* Fri Sep 2 2005 werner@suse.de
- Fix segv on big endian (bug #114066)
* Correct usage of EOF macro, this is and was never a character
* Make it handle missing newline at EOF
- Make it strict alias safe
- Compare the correct debug output in test suite (bug #95371)
* Wed Jul 27 2005 ro@suse.de
- silence some compiler warnings (#95370)
* Mon Jun 27 2005 ro@suse.de
- removed -fsigned-char (#93875)
* Wed Jun 15 2005 meissner@suse.de
- Use RPM_OPT_FLAGS -fno-strict-aliasing.
- compile OPTIMIZE, drop some no longer applying -f flags.
* Mon Mar 1 2004 ro@suse.de
- fix install_info stuff in postun
* Sun Oct 19 2003 ro@suse.de
- use defattr
- don't build as root
* Thu Sep 11 2003 ro@suse.de
- update to 1.42 (#30279)
* Mon Aug 25 2003 ro@suse.de
- update to 1.41
- additional Keyword: PreSaveCommand
* Thu Aug 14 2003 ro@suse.de
- update to 1.38 with additional MetaData keywords
* Mon Jun 16 2003 kukuk@suse.de
- Remove /var/adm/fillup-templates, already in filesystem package
* Wed Mar 12 2003 ro@suse.de
- update to 1.24 including the last two patches and
more testcases for "make check"
* Wed Mar 12 2003 ro@suse.de
- switch behaviour to "fixed sequence of metadata" (#25119)
* Sun Mar 9 2003 ro@suse.de
- fix watchdog for removal part (factor 2 needed)
(fix for reopened #24648)
* Thu Mar 6 2003 ro@suse.de
- update to 1.22 (avoid possible infinite loop on failure) (#24648)
* Thu Mar 6 2003 ro@suse.de
- fix for stale comment when removing variable (#24540)
* Wed Feb 19 2003 ro@suse.de
- update to 1.21
- works around problem with comments wrongly typed as metadata
* Thu Feb 6 2003 ro@suse.de
- added install-info macros
* Thu Nov 28 2002 ro@suse.de
- update to 1.20 beta (aka prototype)
* Mon Nov 11 2002 ro@suse.de
- changed neededforbuild <sp> to <opensp>
* Mon Aug 12 2002 ro@suse.de
- split off aaa_base

Просмотреть файл

@ -785,8 +785,18 @@
"type": "other",
"other": {
"name": "cni",
"version": "0.7.5",
"downloadUrl": "https://github.com/containernetworking/plugins/archive/v0.7.5.tar.gz"
"version": "0.8.1",
"downloadUrl": "https://github.com/containernetworking/cni/archive/refs/tags/v0.8.1.tar.gz"
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "cni-plugins",
"version": "0.9.1",
"downloadUrl": "https://github.com/containernetworking/plugins/archive/v0.9.1.tar.gz"
}
}
},
@ -1521,6 +1531,16 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "fillup",
"version": "1.42",
"downloadUrl": "https://github.com/openSUSE/fillup/archive/refs/tags/1.42.tar.gz"
}
}
},
{
"component": {
"type": "other",