ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: richardl152 on January 10, 2020, 07:34:13 AM

Title: Bug report:exiftool .Exif_config and exported bash functions with hyphen in name
Post by: richardl152 on January 10, 2020, 07:34:13 AM
If I have a simple bash function defined and exported (Mac OSX Terminal Mojave)  eg


transfer-U () {
ls
}
export -f transfer-U


then my execution of Exiftool (which calls .Exiftool_config by default in my root user directory)  has error messages


sh: error importing function definition for `transfer-U'



(and exiftool then goes on to process files normally)

whereas this form (no hyphen), does not.


transferU () {
ls
}
export -f transferU


Can this be reproduced?

------

My $HOME/.Exiftool_config is pretty straightforward as



%Image::ExifTool::UserDefined = (
                              'Image::ExifTool::Composite' => {

#########
                               XYResolution =>  {
                                       Require => {
                                               0 => 'XResolution',
                                               1 => 'YResolution',
                                                         },
                                ValueConv => q{
                                          return $val[0]*$val[1];
                                          },
                                                },


                                FocusCalc =>    {
                                          Require => {
                                           0 => 'FocalLength',
                                           1 => 'ShutterSpeed',
                                                        },
                                ValueConv => q{
                                          return $val[0]*$val[1];
                                          },
                                                },

#########
                                },

                                );


#print "Loading Exiftool completed \n" ;


%Image::ExifTool::UserDefined::Options = (
    RequestAll => 2,        # request additional tags not normally generated
);
#print "Loading RequestAll \n" ;

#------------------------------------------------------------------------------


Title: Re: Bug report:exiftool .Exif_config and exported bash functions with hyphen in name
Post by: Alan Clifford on January 10, 2020, 08:18:13 AM
Proabably hyphens are not allowed in bash variable names.  I'm looking for documentation to confirm this.  Not sure about sh rather than bash.
Title: Re: Bug report:exiftool .Exif_config and exported bash functions with hyphen in name
Post by: Alan Clifford on January 10, 2020, 08:22:23 AM
See definitions section in man bash


      name   A word consisting only of alphanumeric characters and underscores, and
              beginning  with  an  alphabetic  character  or  an  underscore.   Also
              referred to as an identifier.
Title: Re: Bug report:exiftool .Exif_config and exported bash functions with hyphen in name
Post by: richardl152 on January 10, 2020, 08:24:55 AM
thanks - the bash definition works fine in normal use of .bash_aliases etc etc.     Its just when exiftool is invoked (and accessing its .Exiftool_config file) that the exiftool invocation has these errors.  They don't occur anywhere else.  Obviously I'm happy to lose the hyphen,   it just struck me as unusual.
Title: Re: Bug report:exiftool .Exif_config and exported bash functions with hyphen in name
Post by: Alan Clifford on January 10, 2020, 08:35:28 AM
The error appears to have come from the shell rather than from exiftool.